question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Preserve Exif Data

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
hipstersmoothiecommented, Aug 20, 2018

PRs welcome! I’m gonna investigate moving just the bytes over as that seems like it could work well. I’ll probably get to it later this week

1reaction
hipstersmoothiecommented, Aug 20, 2018

@Slyke this is probably an issue with https://github.com/eugeneware/jpeg-js. I have an issue open to encode exif data here. The DPI issue seems different though, you might want to open another issue there.

I might try to pursue this on my own, but I don’t know how easy it will be to add these features to jpeg-js.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is EXIF Data? When to Keep it and When to Remove it
EXIF data, sometimes called metadata, is a collection of information that is stored by the camera at the moment you take a photo....
Read more >
Keep EXIF when exporting?
If you want to keep your EXIF data, just do a "Save As..." (Shift-command/control-s) and any of the image formats that you save...
Read more >
What is EXIF Data and How You Can Remove it From Your ...
Exchangeable Image File Format (EXIF) is a standard that defines specific information related to an image or other media captured by a digital ......
Read more >
Keep your Exif metadata private with this open source tool
ExifCleaner is a cross-platform open source tool that easily removes all Exif metadata from images, videos, PDFs, and other types of files.
Read more >
When working with Snapseed, how do I preserve EXIF data?
EXIF data is only preserved when syncing the photo back to your computer directly. Emailing the photo will not save EXIF data.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found