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

Passing .png encoded as .jpg does not throw error #50

Open
bsansone opened this issue Sep 12, 2017 · 2 comments
Open

Passing .png encoded as .jpg does not throw error #50

bsansone opened this issue Sep 12, 2017 · 2 comments

Comments

@bsansone
Copy link

bsansone commented Sep 12, 2017

Was sent a .jpg image, needed it .png. When downloading the image from Gmail, set format to All Files:

screen shot 2017-09-12 at 3 38 27 pm

Changed extension from .jpg to .png:

screen shot 2017-09-12 at 3 38 35 pm

Having been passing this file which I assumed to be a .png into gd.openPng(), when the img being passed gets to the next method it's used by img.colorAllocate() received error:
"Cannot read property 'colorAllocate' of null". Took me awhile to come to the conclusion it was originally a .jpg that had its extension changed and gd.openPng() couldn't read it because it wasn't encoded as a .png.

@y-a-v-a
Copy link
Owner

y-a-v-a commented Sep 17, 2017

Hi thanks for reaching out and sorry for my late reply.
I could see if it's possible to do a check wether there's actually image data to act upon when someone tried to open e.g. a jpg with gd.openPng().
I understand from your comment you would have preferred to be informed earlier that the assumed png is not a png, right?
I'll see what I can do in the upcoming weeks.
🍻 Cheers! Vincent

@skeddles
Copy link

I also just spent half an hour trying to figure why loading my png was coming up null (it was a jpg I saved at a .png)

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

No branches or pull requests

3 participants