Support

Scan Mode Converting PNG Scan to JPG
Scan Mode

Information in this article applies to:

  • uScope Navigator V4.5 and Later

Article ID: NSC2315 — Created: 25 Aug 2020 — Reviewed: 26 Aug 2020

Question

I have scanned a number of slides using the PNG image format. The disk space required for PNG scans is very large and I have started scanning using the JPEG image format. Is there a way to convert my existing scan from PNG images to JPEG images?

Answer

Yes. There are 2 types of image data to convert.

  • Scan Field Images
  • Deep Zoom Tile Images (optional)

The scan fields are the images of each field that are scanned. The deep zoom tiles are created when uScope Navigator makes a Deep Zoom image.

Note
Always make a backup copy of your job folder before making changes like those shown in this article. These are your source images and they cannot be recovered if they are destroyed or overwritten.

Converting Scan Fields from PNG to JPEG

To convert the Scan Fields to JPEG, you must use a program to convert the image files and you must edit the uSScanInfo.xml file and change the ImageExtension from .png to .jpg.

  1. Scan Field images are stored in the job folder. They are named uS-X000Y000.png ... uS-X099Y099.png.
  2. Additionally, several other PNG images are stored in the job folder.
  3. Use an image conversion utility (like ImageMagick) to convert all of the PNG files to JPEG.

    Note
    uScope Navigator saves all JPEG files using Q85 (quality 85). So, you should convert using that setting if available. The file extension should be .jpg for the JPEG files.

  4. After converting the image files, edit uS-ScanInfo.xml with a text editor.
  5. Find the line containing <ImageExtension>.png</ImageExtension> and change .png to .jpg.

That should be all that's required. At this point, you can delete your existing Deep Zoom images and re-create them using uScope Navigator.

Converting Deep Zoom Tiles from PNG to JPEG

To convert your Deep Zoom images to JPEG, you can simply delete the Deep Zoom images and re-create them within uScope Navigator as mentioned above.

If you prefer not to re-create the Deep Zoom images, you can easily convert the PNG images to JPEG.

  1. Deep Zoom Images are stored in the /<jobname>/DeepZoom-xxxxxxx/DZOutput_files/0,1,2,3,... folders.
  2. Additionally, several other PNG images are stored in the /<jobname>/DeepZoom-xxxxxxx folder.
  3. Use an image conversion utility (like ImageMagick) to convert these files to JPEG.

    Note
    uScope Navigator saves all JPEG files using Q85 (quality 85). So, you should convert using that setting if available. The file extension should be .jpg for the JPEG files.

  4. After converting the image files, use a text editor to edit the DZInfo.xml file found in the DeepZoom-xxxxxxx folder.
  5. Find the line containing <ImageExtension>.png</ImageExtension> and change .png to .jpg.
  6. Use a text editor to edit the DZOutput.xml file found in the DeepZoom-xxxxxxx folder.
  7. Find the line containing <Image xmlns="http://schemas.microsoft.com/deepzoom/2008" ServerFormat="Default" Format="jpg" Overlap="0" TileSize="256"> and change png to jpg.

At this point, your Deep Zoom image should open and display normally.

More Information

ImageMagick is an open-source image creator, editor, composer, and converter that is readily available for a number of different platforms.

Use the following command line to convert all PNG files in the specified folder to JPG.

for %f in (C:\images\job\*.png) do magick convert -quality 85 "%~ff" "%~df%~pf%~nf.jpg"

Use the following command line to convert all PNG files to JPG files in a folder and its sub-folders.

for /R %f in (C:\images\job\Deepzoom-unfiltered\*.png) do
   magick convert -quality 85 "%~ff" "%~df%~pf%~nf.jpg"
Rate This Article
Contact Microscopes International or speak with your local distributor.
Copyright © 2020 Microscopes International, LLC. All rights reserved.