3

How can I convert a png file using terminal or maybe a Python script to a jpg without artifacts; here's what I did and image was malformed: cat.png: enter image description here

jalal@klein:~$ convert cat.png cat.jpg

jalal@klein:~$ eog cat.jpg 

enter image description here

jalal@klein:~$ convert cat.png -quality 95 cat_95.jpg
jalal@klein:~$ eog cat_95.jpg 

enter image description here

  • Not helpful to your question (and I'm glad someone found a solution to the problem!), but I'll just note that the problem you've discovered could be a cool basis for glitch art. – r_alex_hall Nov 11 '17 at 13:44
3

It looks like you are suffering from issues due to the alpha channel in your PNG.
You can remove this and replace with a background of you choice using the following command:

convert cat.png -background white -alpha remove cat.jpg

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.