Hi - As some of you may know, I use the J facilities for reading and writing .JPGs quite a bit. However, for convenience, I've put together an "images" script (as I believe there used to be) that incorporates the current set of read/write verbs we have in J for .BMP,.JPG, and .PNG files (see below, after my signature). So, I have a simple use of agenda to invoke the correct reader or writer based on the suffix of the file name. This way, whenever I work with a file in one of the supported formats, I can use the same verb "read_image" that figures out which variety of I/O I need based on the file suffix.
I'm not sure who's been maintaining this underlying code but I noticed that whereas the jpeg code used to have a global by which the default .JPG quality is controlled (since it's a lossy format), the current version has a default of 75 (75% where higher is better quality, less compression) scattered throughout. This difference requires me to either change the default within the jpeg script, which I did, or remember to specify it every time I write jpeg images, which I don't want to do. So, my general question is how do I get my "images.ijs" cover verbs included within the default J distribution? Along these lines, if I "fix" the existing jpeg code to go back to using a global to control default quality, what's the process for getting this change accepted into the distribution? Thanks, Devon -- Devon McCormick, CFA Quantitative Consultant --- NB.* images.ijs: group various image format handlers to allow image handling NB. without regard to underlying type. coclass 'images' require 'graphics/bmp' require 'graphics/jpeg' require 'graphics/png' extractSuffix=: ]}.~[:>:'.' i:~ ] SUFFS=: 'bmp';'jpg';'png' read_image=: readbmp_jbmp_`readjpeg_jjpeg_`readpng_jpng_`] @. ((SUFFS i. [: < extractSuffix) ]) write_image=: writebmp_jbmp_`writejpeg_jjpeg_`writepng_jpng_`] @. ((SUFFS i. [: < extractSuffix) ]) ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
