BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar



Jun 17, 2013

Scale large images before analyzing

Recently a customer asked me this question:

I am working with your image analyzer and have a request that I don't think would be hard to implement (says the JSL hack).  Could you add an option to only load every xth pixel?

The answer is yes, I could do that for the next version of the Image Analyzer, and it wouldn't be that hard to do. But one way to get a similar result now is to scale the image in JMP. The user went on to explain they just wanted a sampling of pixels. They didn't really need every pixel and it was a large image to begin with. So my suggestion was to do something like this:

img = newImage("$SAMPLE_IMAGES/tile.jpg");

img << scale(0.5);

newWindow("Scaled image", img);


This will scale the image down to 1/4 of the original size (1/2 the width x 1/2 the height) giving the user a sampling of pixels. By the way, you can specify two arguments to scale the width and height by different amounts.

img << scale(0.5, 0.2);

Using this scaling will give you 1/10th the original size, which is what this particular customer was asking for. I should caution you that scaling an image will change the pixel values and you will get interpolated values. This may or may not be an issue for you, depending on what you are doing. If you are doing a color analysis, this probably won't be a problem for you but if you are looking for specific values in the data, the interpolation will modify those values.

I hope this helps!

Article Tags