I have put files worked with at: http://www.kleinfeldtechnical.com/im for reference.
I created a small image with gray values, greyscale.gif, which ranges from a level of 94 to 255. It is used as the starting point for the testing I did. I ran various options, creating a .pgm file as well to examine the pixel values. The file testandnotes.txt has the history of my tests and notes. I used it as a .bat file, remarking out old commands as I tried new ones.
greyscale.gif
I am trying to rescale some scientific images in the long run.
I have tried some manipulations with convert (math function) and with convert (level functions).
Some of these worked as expected. Others would not work at all or gave unexpected results. Any help in guiding me to get these to work the way I think they should, or, more likely, changing my expectations would be appreciated.
Here's a summary of what I tried and where I am having trouble:
for convert math funciton : Multiply and Divide worked as expected, although limited by the 0-255 range available in the image. Add and Subtract did not work as expected. I used pure numbers in the Add and Subtract commands, not %numbers. The commands had no effect at all. Here is the code I used:
Code: Select all
convert greyscale.gif -evaluate divide 2 gover2.gif
convert greyscale.gif -evaluate multiply 2 gtimes2.gif
convert greyscale.gif -evaluate add 25 gplus25.gif
convert greyscale.gif -evaluate subtract 50 gscale-min50.gif
Code: Select all
convert gscale-min50.gif -colorspace gray -compress none -depth 8 gscale-min50.pgm
In reading further, I realized that the Convert -level function would be a better approach to rescaling the images I am planning on adjusting. I also am having similar problems getting this to work.
Here are the commands I tried, with the result I got following the command:
Code: Select all
convert greyscale.gif -level 94,255 gscale-level94-255.gif --this creates an all white image (255)
convert greyscale.gif -level 100,255 gscale-level100-255.gif --this creates an all white image (255)
convert greyscale.gif -level 100 gscale-level100-def.gif -- this had no effect
convert greyscale.gif -level 50,255 gscale-level50-255.gif --this creates an all white image (255)
convert greyscale.gif -level 36.9% gscale-level36pct.gif -- this had no effect
convert greyscale.gif -level 36.9,100% gscale-level36-100pct.gif --this creates an all white image (255)
convert greyscale.gif -level 36.9%,100% gscale-level36pct-100pct.gif -- this had no effect
All guidance is much appreciated.
JK