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

No PNG to JPG conversion on MacOs #13

Closed
pavelberger opened this issue Mar 31, 2017 · 7 comments
Closed

No PNG to JPG conversion on MacOs #13

pavelberger opened this issue Mar 31, 2017 · 7 comments

Comments

@pavelberger
Copy link

Hi Arun! First of all thank you for such a great tool!

I tried to install it on Sierra and ran into the PNG to JPG conversion problem. Everything works as it has to but it simply ignores the PNG files. I have correctly installed python 3.6.1, Pillow and made the make installation as you instructed. All the paths look right, imagemagick is also present. I used different combination of arguments but no luck.

I know you have no MacOs mention in readme file but maybe you can make a Brew package so we can use all options on Mac.

Also I've notice significant colour saturation change, is there any option to manually set the parameters?

@jarun
Copy link
Owner

jarun commented Mar 31, 2017

Simply using option -c should work.

I am on Ubuntu myself so it would be a bit difficult to handle this. However,

  • do you see any output file?
  • if yes, is the output filename changed to *.jpg when you try to convert a png?
  • if possible, can you share one the png images which fails (maybe all PNG fail, but still)?
  • after this iteration I can add some more debug logs to see what's going wrong

I know you have no MacOs mention in readme file but maybe you can make a Brew package so we can use all options on Mac.

There's no apparent reason why it wouldn't work on Mac. I would need a maintainer for Homebrew. I already maintain 7/8 upstream packages. Are you interested?

Also I've notice significant colour saturation change

Too subjective. Can you please share a file? Is it "reasonably" low-res already?

@jarun
Copy link
Owner

jarun commented Apr 3, 2017

Any update here?

@jarun jarun closed this as completed Apr 5, 2017
@jarun
Copy link
Owner

jarun commented Apr 9, 2017

If the image resolution is lower than your target resolution and --enlarge is not used, conversion from PNG to JPG doesn't happen if you opt for it. Just try imgp --convert in that case.

@jarun jarun reopened this Apr 9, 2017
@jarun
Copy link
Owner

jarun commented Apr 9, 2017

I could reproduce this issue. Working on it.

@jarun jarun closed this as completed in d3599c1 Apr 9, 2017
@jarun
Copy link
Owner

jarun commented Apr 9, 2017

I am making the utility a bit verbose when a PNG is not converted if it's of lower resolution than specified target resolution. I don't want to go ahead and do a brute for convert because in some cases the image might be of considerable lower resolution and will lose quality heavily. To convert those images an extra step would be required (imgp -wc). However, the new message at the end of processing makes it easier to detect.

So here's the new workflow as an example.

Initial directory listing:

$ ll
total 18316
-rw-rw-r-- 1 vaio vaio 2691578 Apr  9 10:18 image-105235.png
-rw-rw-r-- 1 vaio vaio  920523 Sep 22  2015 image-140969.png
-rw-rw-r-- 1 vaio vaio 3515686 Apr  9 10:18 image-244227.png
-rw-rw-r-- 1 vaio vaio 3134969 Apr  9 10:18 image-244336.png
-rw-rw-r-- 1 vaio vaio 1199853 Aug 17  2015 image-250114.png
-rw-rw-r-- 1 vaio vaio 1039438 Aug 17  2015 image-250134.png
-rw-rw-r-- 1 vaio vaio 1117636 Aug 17  2015 image-250136.png
-rw-rw-r-- 1 vaio vaio  752320 Aug 17  2015 image-250138.png
-rw-rw-r-- 1 vaio vaio  788448 Aug 17  2015 image-250140.png
-rw-rw-r-- 1 vaio vaio 1174414 Aug 17  2015 image-250153.png
-rw-rw-r-- 1 vaio vaio 1139178 Aug 17  2015 image-250182.png
-rw-rw-r-- 1 vaio vaio 1243785 Aug 17  2015 image-250228.png

First run:

$ imgp -wracx 1366x1000
Source omitted. Processing current directory...

./image-250134.png has lesser hres

./image-250136.png has lesser hres

./image-250114.png has lesser hres

./image-250138.png has lesser hres

./image-250228.png has lesser hres

./image-250153.png has lesser hres

./image-140969.png has lesser hres

./image-250140.png has lesser hres

./image-250182.png has lesser hres

./image-244227.png
1920x1080 -> 1366x768
3515686 bytes -> 159454 bytes

./image-244336.png
1920x1080 -> 1366x768
3134969 bytes -> 103369 bytes

./image-105235.png
1920x1200 -> 1366x854
2691578 bytes -> 94781 bytes

3 converted in 0.6724 seconds.
9 not processed due to low resolution.

Directory listing after first run (low-res PNGs left):

$ ll
total 9528
-rw-rw-r-- 1 vaio vaio   94781 Apr  9 10:38 image-105235.jpg
-rw-rw-r-- 1 vaio vaio  920523 Sep 22  2015 image-140969.png
-rw-rw-r-- 1 vaio vaio  159454 Apr  9 10:38 image-244227.jpg
-rw-rw-r-- 1 vaio vaio  103369 Apr  9 10:38 image-244336.jpg
-rw-rw-r-- 1 vaio vaio 1199853 Aug 17  2015 image-250114.png
-rw-rw-r-- 1 vaio vaio 1039438 Aug 17  2015 image-250134.png
-rw-rw-r-- 1 vaio vaio 1117636 Aug 17  2015 image-250136.png
-rw-rw-r-- 1 vaio vaio  752320 Aug 17  2015 image-250138.png
-rw-rw-r-- 1 vaio vaio  788448 Aug 17  2015 image-250140.png
-rw-rw-r-- 1 vaio vaio 1174414 Aug 17  2015 image-250153.png
-rw-rw-r-- 1 vaio vaio 1139178 Aug 17  2015 image-250182.png
-rw-rw-r-- 1 vaio vaio 1243785 Aug 17  2015 image-250228.png

Second run:

$ imgp -wc
Source omitted. Processing current directory...

./image-250136.png
1258x818 -> 1258x818
1117636 bytes -> 95647 bytes

./image-250134.png
1262x822 -> 1262x822
1039438 bytes -> 71675 bytes

./image-250228.png
1238x818 -> 1238x818
1243785 bytes -> 67556 bytes

./image-250114.png
1273x817 -> 1273x817
1199853 bytes -> 80808 bytes

./image-250138.png
1330x819 -> 1330x819
752320 bytes -> 65551 bytes

./image-250153.png
1221x819 -> 1221x819
1174414 bytes -> 82487 bytes

./image-140969.png
1240x829 -> 1240x829
920523 bytes -> 53590 bytes

./image-250182.png
1189x819 -> 1189x819
1139178 bytes -> 52125 bytes

./image-250140.png
1309x821 -> 1309x821
788448 bytes -> 58432 bytes

9 converted in 0.5635 seconds.

Listing after second run (all converted):

$ ll
total 992
-rw-rw-r-- 1 vaio vaio  94781 Apr  9 10:38 image-105235.jpg
-rw-rw-r-- 1 vaio vaio  53590 Apr  9 10:59 image-140969.jpg
-rw-rw-r-- 1 vaio vaio 159454 Apr  9 10:38 image-244227.jpg
-rw-rw-r-- 1 vaio vaio 103369 Apr  9 10:38 image-244336.jpg
-rw-rw-r-- 1 vaio vaio  80808 Apr  9 10:59 image-250114.jpg
-rw-rw-r-- 1 vaio vaio  71675 Apr  9 10:59 image-250134.jpg
-rw-rw-r-- 1 vaio vaio  95647 Apr  9 10:59 image-250136.jpg
-rw-rw-r-- 1 vaio vaio  65551 Apr  9 10:59 image-250138.jpg
-rw-rw-r-- 1 vaio vaio  58432 Apr  9 10:59 image-250140.jpg
-rw-rw-r-- 1 vaio vaio  82487 Apr  9 10:59 image-250153.jpg
-rw-rw-r-- 1 vaio vaio  52125 Apr  9 10:59 image-250182.jpg
-rw-rw-r-- 1 vaio vaio  67556 Apr  9 10:59 image-250228.jpg

jarun added a commit that referenced this issue Apr 9, 2017
1. Enable log if file not converted due to low-res
2. Show count of images not processed due to low-res
jarun added a commit that referenced this issue Apr 9, 2017
1. Enable log if file not converted due to low-res
2. Show count of images not processed due to low-res
@jarun
Copy link
Owner

jarun commented Apr 9, 2017

Also P.S. 59751f4, which adds option --size to specify the minimum size of an image to get processed. imgp is lossy, this works as a guard against modifying very low quality images to some extent.

@jarun
Copy link
Owner

jarun commented Apr 18, 2017

We have a Homebrew tap now.

@lock lock bot locked and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants