Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata in PGM file not being preserved #1425

Closed
dchaddock opened this issue Dec 17, 2018 · 3 comments
Closed

Metadata in PGM file not being preserved #1425

dchaddock opened this issue Dec 17, 2018 · 3 comments
Labels
Milestone

Comments

@dchaddock
Copy link

dchaddock commented Dec 17, 2018

Description

When running "convert" on a PGM file with metadata between the magic number and dimension/bitdepth lines, any new line characters are removed. This behaviour started at 7.0.8-x from what I can tell. All prior versions that I have worked with have preserved the new line characters (7.0.7, 6.x).

Head of file before running convert:

$ head -n 6 white.pgm 
P5
# metadata line 1
# metadata line 2
# metadata line 3
100 100
65535

Head of file after running convert:

$ head -n 4 new.pgm 
P5
# metadata line 1 metadata line 2 metadata line 3
100 100
65535

If this isn't a bug, would it be possible to add in a flag of '-preserve-exact-metadata' or something like that?

Steps to Reproduce

  1. Create a blank PGM file
    convert -size 100x100 xc:white white.pgm
  2. Insert metadata into file
    sed -i -e '/^P5/s/P5/P5\n# metadata line 1\n# metadata line 2\n# metadata line 3/g' white.pgm
  3. Run convert (note, I realize that running convert on this image actually doesn't accomplish anything, but, it's the most basic example)
    convert white.pgm new.pgm

System Configuration

  • CentOS 7, x64, kernel version, kernel 3.10.0-862.14.4.el7.x86_64
  • Behaviour occurs on ImageMagick 7.0.8-16, 7.0.8-14
  • No problems with ImageMagick 7.0.7-22, 6.x
@urban-warrior
Copy link
Member

Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ https://www.imagemagick.org/download/beta/ by sometime tomorrow.

urban-warrior pushed a commit to ImageMagick/ImageMagick6 that referenced this issue Dec 19, 2018
@dlemstra dlemstra added the bug label Dec 19, 2018
@dlemstra dlemstra added this to the 7.0.8-18 milestone Dec 19, 2018
@dchaddock
Copy link
Author

Great, thanks!

@dchaddock
Copy link
Author

This seems to be happening again in Imagemagick 6.7.8-9. I'm not sure when it was reintroduced though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants