I'm trying to save an 8 bit wave to a 16 bit image and maintain the scale of the image, using ImageSave. Attached is graphic. Is it possible to save an 8 bit wave to a 16 bit image and maintain the "scale" of the image? By scale, I mean the ratio of a given pixel intensity to the max intensity for a given bit depth (255 for 8bit or 65535 for 16bit)? I'm using IP7.
Same problem. The ImageSave function appears to scale the created image based upon the min and max value of the image. So if I scale the 8 bit image values to 16 bit values before I save it, the same problem occurs. The solution I'm currently using is to save it twice. I first save the 8 bit wave to a 16 bit image, then reload the image back into Igor, scale it (based upon the 8 bit image), and then save it again as 16 bit. The 16 bit to 16 bit save, does not change the scale.
Is it possible to save an 8 bit wave to a 16 bit image and maintain the "scale" of the image? By scale, I mean the ratio of a given pixel intensity to the max intensity for a given bit depth (255 for 8bit or 65535 for 16bit)? I'm using IP7.
Clayton
Note that the documentation tells you that the normalization option (/U) applies to TIFF files. If you are saving jpg images (as may be implied by the image you posted) there is no sense to trying the 16 bit option.
FWIW, it would really be far more useful to see the syntax of the commands you used than to see a jpg image.
In the image I attached I tried to show that both ImageSave/I/DS=16/T="tiff" Image_8bit
and ImageSave/I/DS=16/U/T="tiff" Image_8bit
give the same result.
To describe my second comment in a bit more detail. I have an 8bit wave, I save this wave to an image using: ImageSave/I/DS=16/T="tiff" Image_8Bit as "Image_16bit.tif"
then I load the 16 bit image back into Igor, modify it via the scale of the 8bit image and then save again:
matrixop/o Image_16bit=(Image_8bit/255)*65535 ImageSave/I/DS=16/T="tiff" Image_16bit as "SameScaleImage"
The 16 bit to 16 bit save appears to maintains the scale. The 8 bit to 16 bit always modifies it.
January 11, 2017 at 02:40 pm - Permalink
January 11, 2017 at 04:25 pm - Permalink
ImageSave/U
for not normalizing? According to the IP7 documentation this is what you want.PS: It is much easier to help if you post a minimal working example.
January 12, 2017 at 07:03 am - Permalink
Note that the documentation tells you that the normalization option (/U) applies to TIFF files. If you are saving jpg images (as may be implied by the image you posted) there is no sense to trying the 16 bit option.
FWIW, it would really be far more useful to see the syntax of the commands you used than to see a jpg image.
January 12, 2017 at 10:11 am - Permalink
ImageSave/I/DS=16/T="tiff" Image_8bit
and
ImageSave/I/DS=16/U/T="tiff" Image_8bit
give the same result.
To describe my second comment in a bit more detail. I have an 8bit wave, I save this wave to an image using:
ImageSave/I/DS=16/T="tiff" Image_8Bit as "Image_16bit.tif"
then I load the 16 bit image back into Igor, modify it via the scale of the 8bit image and then save again:
ImageSave/I/DS=16/T="tiff" Image_16bit as "SameScaleImage"
The 16 bit to 16 bit save appears to maintains the scale. The 8 bit to 16 bit always modifies it.
January 12, 2017 at 10:20 am - Permalink
redimension/w image_16bit
matrixop/o image_16bit=(image_8bit/255)*65535
ImageSave/I/DS=16/T="tiff" Image_16bit
January 12, 2017 at 11:13 am - Permalink
I don't think this code is executing in the manner that you expect. The two lines:
redimension/w image_16bit
Furthermore, the result of the expression
(image_8bit/255)*65535
is NOT 16 bit wave; check it out and you will find it is SP!To get a 16bit wave you can execute:
I hope this helps,
A.G.
January 13, 2017 at 12:38 pm - Permalink
January 16, 2017 at 02:52 pm - Permalink