cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
JohnPonte
Staff (Retired)
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);

saveImage("scaledTile.jpg");

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!

Last Modified: Nov 5, 2015 1:34 PM
Comments