jimp-dev/jimp

Preserve Exif Data

Open

#556 opened on Aug 20, 2018

View on GitHub
 (6 comments) (1 reaction) (0 assignees)JavaScript (13,218 stars) (785 forks)batch import
bughelp wanted

Description

Expected Behavior

Image is being saved with a horizontal and vertical resolution of 96 dpi, even though the input image is 1 dpi. The Resolution Unit also doesn't appear to be saved.

Current Behavior

Jimp is setting its own values, regardless of the input image. There doesn't appear to be a way to change these settings either.

Failure Information (for bugs)

I would expect the meta data to remain the same when saving an image from an input image, but it doesn't appear so.

Steps to Reproduce

var jimp = require('jimp');
const fs = require('fs');

jimp.read('image.jpg', (err, img1) => {
  if (err) throw err;
  const debugOut = JSON.parse(JSON.stringify(img1));
  debugOut.bitmap.data = [];
  fs.writeFile('data.txt', JSON.stringify(debugOut, null, 4), (err3) => {  
    if (err3) throw err;
  });
  img1.write('OUTPUT.JPG'); 
});

Context

I'm working with equirectangular images and creating a script to stitch images together from a Yi VR camera. It is paramount that the metadata stays intact for the images otherwise they can't be stitched. Images can be manually edited in paint, but I it would go much faster if I can automate it. Jimp seems to be ignoring the metadata for an image, no matter what I set it to:

    img1._exif.XResolution = 1;
    img1._exif.YResolution = 1;
  • Jimp Version: 0.3.5
  • Operating System: Windows 10
  • Node version: 8.9.4

Contributor guide