Skip to main content

Hello,

I am aware that JPEG2000 is not the most ideal format for images if one wants to preserve quality but I don't have a choice of other formats in the external files I have to work with.

Anyway, I would like to clip these external JPEG2000 files using clipper polygons and save the output as JPEG2000. At the same time I would like to avoid a change in the original-to-clipped raster pixel values unless they are on edges of the clipper polygons. So, I have set the compression in writer to 0 but still, for some reasons, the clipped raster values are quite different to the original raster values. Would I be correct in thinking that given the choice of image output format, it may not be possible to preserve original raster values? Any ideas please..

Thanks,

S.

How are you doing the clipping? Is that on a pixel edge, or not? If not, it'll mean you will actually resample the image which may lead to different results.

And even if you do clip on a pixel edge the FME Help specifically states that setting a compression level of 0 still does not guarantee the pixel values will be the same as the input.


Thanks for the response. Its a pretty standard clipper transformer with all default options. Pixel is definitely not on the edge so there must be some resampling taking place due to transformers attempt at working out the extent of the image. Could setting the "Preserve Clipping Extent" to "Yes" make any difference?


Don't think so, that would only come into play if your clippee is smaller than the clipper.

Your best bet is to make sure the clipper feature is snapped to the pixel edges. You can use a RasterCellCoercer to create polygons from pixels and then snap the clipper to that, but that's a very hefty operation and even then there's no guarantee the result will have the same pixel values as the input.


Alright - thanks. I think there might be some other issues too. I can't exactly remember where I read this - apparently JPEG2000 compression/decompression results can vary a fair bit depending upon the application.


Reply