X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 07 Oct 2011 02:41 PM by  anon
how to save as jpg or png
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
07 Oct 2011 02:41 PM
    saving float array as a jpg or png. for example, 3 bands from a reflectance satellite image I tried write_jpg and write_png. however, the picture did not show the image successfully. I guess the reason is the pixel value is between 0-1, not 0-255. So, what should i do to save a image as jpg or png files. thanks

    Deleted User



    New Member


    Posts:
    New Member


    --
    10 Oct 2011 10:33 AM
    There is a routine called BYTSCL that will rescale images image pixels from 0 through 255. Therefore, if your image is composed of ones and zeros, and you use the BYTSCL on the image, the ones will be replaced by 255. After you have made this change, you should be able to save the file to a jpeg or png file without too much trouble. For example: IDL> image1 = [0,0,0,0, $ > 0,1,1,0, $ > 0,1,1,0, $ > 0,0,0,0] IDL> image1=REFORM(image1,4,4) IDL> print, image1 0 0 0 0 0 1 1 0 0 1 1 0 0 0 0 0 IDL> image1 = BYTSCL(image1) IDL> print, image1 0 0 0 0 0 255 255 0 0 255 255 0 0 0 0 0 IDL> WRITE_JPEG, 'test.jpg', image1

    Deleted User



    New Member


    Posts:
    New Member


    --
    21 Nov 2011 04:31 PM
    thanks.
    You are not authorized to post a reply.