*ImageMagickResult.tif is the image created through the convert command line tool *JavaResult.tif is the image created using im4java's convert operation through javaĪs you can see, the layers that are created are very similar to the layers created in the image converted through ImageMagick's "convert" command line utility: But if we use ImageMagick's "identify" tool, it reveals that other layers do exist within the image: OpenSlide can still open and visualize the image, but it is very laggy when scrolling and zooming because the pyramid functionality is lost. When we convert an image into a pyramidal TIFF using the im4java API, OpenSlide only recognizes the full-resolution layer of the image (Layer 0).
#IMAGEMAGICK JAVA CODE#
Here is the sample code from the project that converts an image to a tiled pyramidal tiff using the im4java library:Ĭonvert.addImage(tempFile.getAbsolutePath()) Ĭfine("tiff:tile-geometry=256x256") Ĭfine("tiff:rows-per-strip=16") Ĭonvert.addImage("'ptif:"+result.getAbsolutePath()+"'") Theoretically, running a convert operation through im4Java should mimic the "convert" command line utility of ImageMagick. ImageMagick has a Java API called Im4java that acts as a Java interface to the ImageMagick command-line.
We are able to successfully convert these single-layered TIFF images into tiled pyramidal TIFF images that are compatible with OpenSlide by using ImageMagick's "convert" command line tool.Ĭonvert image.tif -define tiff:tile-geometry=256x256 -compress jpeg 'ptif:newimage.tif'Īfter using this command to convert our single layerd TIFF into a pyramidal TIFF, OpenSlide works perfectly with the resulting image.Ī problem arises because we wish to have everything implemented in Java without having to explicitly use the command line to convert these images into tiled pyramidal TIFFs.
#IMAGEMAGICK JAVA FULL#
However, the image files that we are currently working with are single-layered full resolution TIFF images, which is not a compatible format with OpenSlide. I am currently working on a Java project that uses the OpenSlide library to visualize large tiled pyramidal TIFF files.