jarun / imgp

:camera_flash: Fast batch image resizer and rotator
GNU General Public License v3.0
1.03k stars 50 forks source link

Progressive jpeg #28

Closed motioncircus closed 6 years ago

motioncircus commented 6 years ago

More of a question than an issue.. I generate and upload lots of 5K images to a web gallery and would like to present them progressively. I use imgp and love it's speed but I can't find any reference to progressive mode. Is it on the road map? Thanks Sdack

jarun commented 6 years ago

So I assume you want progressive mode support. Is that correct?

motioncircus commented 6 years ago

Hi Arun,

I would like that very much. I understand progressive is making a bit of a come back, for high resolution full screen image delivery. I may be wrong but I would definitely use it.

Best wishes Nigel Nigel Haslam | Director

Motion Circus Pty Ltd. Byron Bay t: + 61 2 8007 7338 |m: + 61 403 020 126 w: www.motioncircus.com http://www.motioncircus.com/ link to website http://motioncircus.com

On Fri, Sep 7, 2018 at 11:23 AM Arun Prakash Jana notifications@github.com wrote:

So I assume you want progressive mode support. Is that correct?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jarun/imgp/issues/28#issuecomment-419290931, or mute the thread https://github.com/notifications/unsubscribe-auth/AIQ3EywBzDXCPFBj-Z2SPnbmehqoOJp3ks5uYcqjgaJpZM4WcTGz .

jarun commented 6 years ago

I see some indicative code:

Please try to send in a patch.

The ROI of imgp development is literally 0 while there are users who use it after every trip taken. No contributors, 0 donation. So I am quite reluctant to dedicate my time and effort into it. Help yourself.

motioncircus commented 6 years ago

I hear you,

I'm not a proficient coder so please explain.. are you suggesting I could add a function to the imgp command list and use it to call the relevant function in PIL?

Would you be prepared to do this for a fee, and if, so, how much would it cost?

Cheers

Nigel Haslam | Director

Motion Circus Pty Ltd. Byron Bay t: + 61 2 8007 7338 |m: + 61 403 020 126 w: www.motioncircus.com http://www.motioncircus.com/ link to website http://motioncircus.com

On Fri, Sep 7, 2018 at 12:03 PM Arun Prakash Jana notifications@github.com wrote:

I see some indicative code:

Please try to send in a patch.

The ROI of imgp development is literally 0 while there are users who use it after every trip taken. No contributors, 0 income. So I am quite reluctant to dedicate my time and effort into it. Help yourself.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jarun/imgp/issues/28#issuecomment-419296901, or mute the thread https://github.com/notifications/unsubscribe-auth/AIQ3E7io24JHpnVUlKxBksBaFThL5Birks5uYdP3gaJpZM4WcTGz .

jarun commented 6 years ago

I'm not a proficient coder so please explain

I think the simplest way is to add a new argument that says enable progressive mode detection and save progressive images as progressive. If this argument is passed (True), detect if the image is progressive while loading the image. If the image is progressive transform it and save it as progressive. There's a catch here - it needs to be investigated if the image transformations (like resize and rotate) are supported by the PIL library.

Would you be prepared to do this for a fee

It's GPL so it's free. Which also means anyone can modify the code and contribute back. If you find the utility useful, feel free to donate.

motioncircus commented 6 years ago

Thanks for the insight but it was a bit 'over my head' - which means I could follow it but don't think I could code it.

You misunderstood my offer of payment. I know imgp is GPL and open source but if I contributed directly to you, would you be prepared to add this feature and then include it in the main build for others to use too?

And, if so, how much time do you think it would take and how much would you be happy to accept as payment?

N

Nigel Haslam | Director

Motion Circus Pty Ltd. Byron Bay t: + 61 2 8007 7338 |m: + 61 403 020 126 w: www.motioncircus.com http://www.motioncircus.com/ link to website http://motioncircus.com

On Fri, Sep 7, 2018 at 12:48 PM Arun Prakash Jana notifications@github.com wrote:

I'm not a proficient coder so please explain

I think the simplest way is to add a new argument that says enable progressive mode detection and save progressive images as progressive. If this argument is passed (True), detect if the image is progressive while loading the image. If the image is progressive transform it and save it as progressive. There's a catch here - it needs to be investigated if the image transformations (like resize and rotate) are supported by the PIL library.

Would you be prepared to do this for a fee

It's GPL so it's free. Which also means anyone can modify the code and contribute back. If you find the utility useful, feel free to donate.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jarun/imgp/issues/28#issuecomment-419304446, or mute the thread https://github.com/notifications/unsubscribe-auth/AIQ3EzS6gVchSNOluwXf_wOLgyDEOCuvks5uYd5_gaJpZM4WcTGz .

jarun commented 6 years ago

Let me check the feasibility in that case. I will get back with what I find.

motioncircus commented 6 years ago

Hey Arun,

To be clearer on my part and save you trouble researching if my offer isn't in the ballpark.. If you could code it into imgp for US $30, I'd be happy to pay for it.

Cheers and have a great weekend

Nigel

Nigel Haslam | Director

Motion Circus Pty Ltd. Byron Bay t: + 61 2 8007 7338 |m: + 61 403 020 126 w: www.motioncircus.com http://www.motioncircus.com/ link to website http://motioncircus.com

On Fri, Sep 7, 2018 at 2:10 PM Arun Prakash Jana notifications@github.com wrote:

Let me check the feasibility in that case. I will get back with what I find.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jarun/imgp/issues/28#issuecomment-419316811, or mute the thread https://github.com/notifications/unsubscribe-auth/AIQ3E3FVNU2-OZfllSxVhytTGCP9Zjjqks5uYfGZgaJpZM4WcTGz .

jarun commented 6 years ago

Thanks a lot for the offer.

motioncircus commented 6 years ago

I hope you are serious,

I have no idea whether it's a five minute, or a five hour job.

N

Nigel Haslam | Director

Motion Circus Pty Ltd. Byron Bay t: + 61 2 8007 7338 |m: + 61 403 020 126 w: www.motioncircus.com http://www.motioncircus.com/ link to website http://motioncircus.com

On Fri, Sep 7, 2018 at 3:26 PM Arun Prakash Jana notifications@github.com wrote:

Thanks a lot for the offer.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jarun/imgp/issues/28#issuecomment-419326809, or mute the thread https://github.com/notifications/unsubscribe-auth/AIQ3E-l8GIwRGxrTmh9DGLL06VGh-Drkks5uYgN3gaJpZM4WcTGz .

jarun commented 6 years ago

Even I don't. I will check the effort required. There are areas I need to investigate. The most critical part is - if PIL supports the transformations for progressive images.

motioncircus commented 6 years ago

I am certain that the source jpegs are not progressive. It's the output jpegs I would like to be progressive

I hope that helps

N Nigel Haslam | Director

Motion Circus Pty Ltd. Byron Bay t: + 61 2 8007 7338 |m: + 61 403 020 126 w: www.motioncircus.com http://www.motioncircus.com/ link to website http://motioncircus.com

On Fri, Sep 7, 2018 at 3:47 PM Arun Prakash Jana notifications@github.com wrote:

Even I don't. I will check the effort required. There are areas I need to investigate. The most critical part is - if PIL supports the transformations for progressive images.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jarun/imgp/issues/28#issuecomment-419329982, or mute the thread https://github.com/notifications/unsubscribe-auth/AIQ3E8ftTr3MHptvcVLIouBdQQDvI3qqks5uYgiAgaJpZM4WcTGz .

jarun commented 6 years ago

Hi @motioncircus,

I did a little research. Here are the tasks I could figure out in pieces:

I can work it out in the weekend. Does $50 sound too much?

motioncircus commented 6 years ago

Hi Arun,

Thanks for sharing your list of potential tasks to add progressive capabilities to imgp. As long as you don't hit any snags, it looks pretty straightforward, to my reasoning.

There are a few web resources to check and convert the progressive status of a jpeg.

https://www.imgonline.com.ua/eng/progressive-or-baseline-jpeg.php

http://techslides.com/demos/progressive-test.html

$50 is is a bit steep, how about $40?

N

On Sat, 8 Sep. 2018, 12:23 am Arun Prakash Jana, notifications@github.com wrote:

Hi @motioncircus https://github.com/motioncircus,

I did a little research. Here are the tasks I could figure out in pieces:

  • add a new argument to save JPEG images as progressive
  • detect if a JPEG image is progressive and save it as progressive. I think currently we do not retain the progressive aspect of it.
  • if the progressive argument is passed, save all JPEG images as progressive
  • update documents, help and man page with the new argument
  • test and confirm that the output images are indeed progressive. Do you know any quick way to figure it out? Otherwise I would have to look for some utility.

I can work it out in the weekend. Does $50 sound too much?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jarun/imgp/issues/28#issuecomment-419455424, or mute the thread https://github.com/notifications/unsubscribe-auth/AIQ3E0kCJ9p6RLzmn3b1Q93HpHYWzI0tks5uYoFXgaJpZM4WcTGz .

jarun commented 6 years ago

$50 is is a bit steep, how about $40?

Done!

jarun commented 6 years ago

@motioncircus I had added JPEG support to latest master. Can you please confirm if your output JPEG files are progressive as expected? You will have to use the new switch --pr.

motioncircus commented 6 years ago

Hi, That was quick. Thanks a lot. I will test it and confirm. Nigel

On Sat, 8 Sep. 2018, 11:53 pm Arun Prakash Jana, notifications@github.com wrote:

@motioncircus https://github.com/motioncircus I had added JPEG support to latest master. Can you please confirm if your output JPEG files are progressive as expected? You will have to use the new switch --pr.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jarun/imgp/issues/28#issuecomment-419643585, or mute the thread https://github.com/notifications/unsubscribe-auth/AIQ3Ex1pMT2bH2UggB731axuKdw36va8ks5uY8vLgaJpZM4WcTGz .

motioncircus commented 6 years ago

Hi Arun,

Please send me a link to the latest master. I had a look around on GitHub but it isn't easily found.

Cheers

Nigel Nigel Haslam | Director

Motion Circus Pty Ltd. Byron Bay t: + 61 2 8007 7338 |m: + 61 403 020 126 w: www.motioncircus.com http://www.motioncircus.com/ link to website http://motioncircus.com

On Sun, Sep 9, 2018 at 7:55 AM Nigel Haslam nigelhaslam@gmail.com wrote:

Hi, That was quick. Thanks a lot. I will test it and confirm. Nigel

On Sat, 8 Sep. 2018, 11:53 pm Arun Prakash Jana, notifications@github.com wrote:

@motioncircus https://github.com/motioncircus I had added JPEG support to latest master. Can you please confirm if your output JPEG files are progressive as expected? You will have to use the new switch --pr.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jarun/imgp/issues/28#issuecomment-419643585, or mute the thread https://github.com/notifications/unsubscribe-auth/AIQ3Ex1pMT2bH2UggB731axuKdw36va8ks5uY8vLgaJpZM4WcTGz .

motioncircus commented 6 years ago

Don't bother,

I found it from a link you sent me last year sometime when I was having problems with my Canon camera jpeg output.

Testing now Nigel Haslam | Director

Motion Circus Pty Ltd. Byron Bay t: + 61 2 8007 7338 |m: + 61 403 020 126 w: www.motioncircus.com http://www.motioncircus.com/ link to website http://motioncircus.com

On Sun, Sep 9, 2018 at 8:57 AM Nigel Haslam nigelhaslam@gmail.com wrote:

Hi Arun,

Please send me a link to the latest master. I had a look around on GitHub but it isn't easily found.

Cheers

Nigel Nigel Haslam | Director

Motion Circus Pty Ltd. Byron Bay t: + 61 2 8007 7338 |m: + 61 403 020 126 w: www.motioncircus.com http://www.motioncircus.com/ link to website http://motioncircus.com

On Sun, Sep 9, 2018 at 7:55 AM Nigel Haslam nigelhaslam@gmail.com wrote:

Hi, That was quick. Thanks a lot. I will test it and confirm. Nigel

On Sat, 8 Sep. 2018, 11:53 pm Arun Prakash Jana, < notifications@github.com> wrote:

@motioncircus https://github.com/motioncircus I had added JPEG support to latest master. Can you please confirm if your output JPEG files are progressive as expected? You will have to use the new switch --pr.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jarun/imgp/issues/28#issuecomment-419643585, or mute the thread https://github.com/notifications/unsubscribe-auth/AIQ3Ex1pMT2bH2UggB731axuKdw36va8ks5uY8vLgaJpZM4WcTGz .

motioncircus commented 6 years ago

Hi Arun,

I just did a test but the result fails the online progressive test

Here's my command.. showing that I'm using the latest master because it works with the -p option

[image: ProgressiveCommand.JPG]

And here's the result from an online checker, claiming that the file isn't progressive

[image: NotProgressiveResult.JPG]

and here are the two test images, the source:

motioncircus/temp/TestProgressive.jpg

and the output

motioncircus/temp/TestProgressive_IMGP.jpg

Any ideas?

Here's a good page with descriptions of progressive approaches

https://cloudinary.com/blog/progressive_jpegs_and_green_martians Nigel Haslam | Director

Motion Circus Pty Ltd. Byron Bay t: + 61 2 8007 7338 |m: + 61 403 020 126 w: www.motioncircus.com http://www.motioncircus.com/ link to website http://motioncircus.com

On Sun, Sep 9, 2018 at 8:59 AM Nigel Haslam nigelhaslam@gmail.com wrote:

Don't bother,

I found it from a link you sent me last year sometime when I was having problems with my Canon camera jpeg output.

Testing now Nigel Haslam | Director

Motion Circus Pty Ltd. Byron Bay t: + 61 2 8007 7338 |m: + 61 403 020 126 w: www.motioncircus.com http://www.motioncircus.com/ link to website http://motioncircus.com

On Sun, Sep 9, 2018 at 8:57 AM Nigel Haslam nigelhaslam@gmail.com wrote:

Hi Arun,

Please send me a link to the latest master. I had a look around on GitHub but it isn't easily found.

Cheers

Nigel Nigel Haslam | Director

Motion Circus Pty Ltd. Byron Bay t: + 61 2 8007 7338 |m: + 61 403 020 126 w: www.motioncircus.com http://www.motioncircus.com/ link to website http://motioncircus.com

On Sun, Sep 9, 2018 at 7:55 AM Nigel Haslam nigelhaslam@gmail.com wrote:

Hi, That was quick. Thanks a lot. I will test it and confirm. Nigel

On Sat, 8 Sep. 2018, 11:53 pm Arun Prakash Jana, < notifications@github.com> wrote:

@motioncircus https://github.com/motioncircus I had added JPEG support to latest master. Can you please confirm if your output JPEG files are progressive as expected? You will have to use the new switch --pr.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jarun/imgp/issues/28#issuecomment-419643585, or mute the thread https://github.com/notifications/unsubscribe-auth/AIQ3Ex1pMT2bH2UggB731axuKdw36va8ks5uY8vLgaJpZM4WcTGz .

jarun commented 6 years ago

Can you please send me the image?

motioncircus commented 6 years ago

Did the image links not work?

I tried to send images but they exceeded the email limit

N

On Sun, 9 Sep. 2018, 11:41 am Arun Prakash Jana, notifications@github.com wrote:

Can you please send me the image?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jarun/imgp/issues/28#issuecomment-419684540, or mute the thread https://github.com/notifications/unsubscribe-auth/AIQ3E-IDvmU9eerLPYXnzvBoMl-uGcmWks5uZHHTgaJpZM4WcTGz .

jarun commented 6 years ago

works with the -p option

The option for progressive is --pr

I downloaded - http://motioncircus.com/temp/TestProgressive.jpg

I ran:

imgp -x 50 TestProgressive.jpg --pr

When I uploaded the image to https://www.imgonline.com.ua/eng/progressive-or-baseline-jpeg.php it is confirmed as progressive.

jarun commented 6 years ago

Does it work correctly with the option --pr?

motioncircus commented 6 years ago

If you look at the screengrab of my command line output that I sent, you will see that the "--pr" option, without any other transformation, returns the error "missing transformation"

While the single hyphen "-pr" produces an image output and no error

The resulting image is considerably more compressed and fails the progressive test.

N

On Sun, 9 Sep. 2018, 12:05 pm Arun Prakash Jana, notifications@github.com wrote:

Does it work correctly with the option --pr?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jarun/imgp/issues/28#issuecomment-419685330, or mute the thread https://github.com/notifications/unsubscribe-auth/AIQ3E_5fxbBDBR75Cwa-ZoXAemfgw3NNks5uZHd2gaJpZM4WcTGz .

jarun commented 6 years ago

I didn't get any mail from you yet. But please try:

imgp -x 100 TestProgressive.jpg

"missing transformation" is thrown when you don't use the resize or rotate option. -x 100 says use 100% resolution.

jarun commented 6 years ago

Sorry, the right command is:

imgp -x 100 TestProgressive.jpg --pr
motioncircus commented 6 years ago

Ok thanks, I will try in the next hour.. I am not at my desk right now. N

On Sun, 9 Sep. 2018, 12:51 pm Arun Prakash Jana, notifications@github.com wrote:

I didn't get any mail from you yet. But please try:

imgp -x 100 TestProgressive.jpg

"missing transformation" is thrown when you don't use the resize or rotate option. -x 100 says use 100% resolution.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jarun/imgp/issues/28#issuecomment-419686832, or mute the thread https://github.com/notifications/unsubscribe-auth/AIQ3E4ozQ915mcJrMH1gG_8ZZw5Hvwdeks5uZII1gaJpZM4WcTGz .

jarun commented 6 years ago

No problem. I would also make the changes where it works without the -x 100 input in the meantime.

motioncircus commented 6 years ago

Hi Arun, I tried again with your command and it tests as positive now, however when I view the image online here:

http://motioncircus.com/temp/TestProgressive_IMGP_V2.jpg

It doesn't show any visible sign of it's progressive nature ie. It should start rather blocky and become clearer and clearer.

Here's a page which explains how it works.

https://www.slrlounge.com/jpeg-formats-know-choose-ones/

I'm not suggesting you haven't implemented progressive properly. I'm simply asking if it's possible to adjust the way it displays, so I can optimize it further if necessary. I think the options are simply to chose how many scans the image offers.

N

Nigel Haslam | Director

Motion Circus Pty Ltd. Byron Bay t: + 61 2 8007 7338 |m: + 61 403 020 126 w: www.motioncircus.com http://www.motioncircus.com/ link to website http://motioncircus.com

On Sun, Sep 9, 2018 at 12:54 PM Arun Prakash Jana notifications@github.com wrote:

No problem. I would also make the changes where it works without the -x 100 input in the meantime.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jarun/imgp/issues/28#issuecomment-419686949, or mute the thread https://github.com/notifications/unsubscribe-auth/AIQ3Ezex2pnGz8wIIuSAPzfhbKprjCk-ks5uZILigaJpZM4WcTGz .

jarun commented 6 years ago

Hi Nigel,

With commit 5658ca8980b7e04c4a484999a7dd336110ead282 in master (take latest), now you can use:

imgp  TestProgressive.jpg --pr --keep

to avoid any transformation.

Or if you want optimization (enabled by default), just run:

imgp  TestProgressive.jpg --pr
motioncircus commented 6 years ago

Thanks Arun, I really appreciate your work, speed and patience, with my lack of understanding.

I hope you will be able to either, add a variable to choose the number of scans, or, at least, set the default number of scans to something that is visible when I view it in a browser. I just viewed my latest, progressive, version on my phone, using mobile data, and I still couldn't see it step up incrementally in quality.

N

On Sun, 9 Sep. 2018, 2:38 pm Arun Prakash Jana, notifications@github.com wrote:

Hi Nigel,

With commit 5658ca8 https://github.com/jarun/imgp/commit/5658ca8980b7e04c4a484999a7dd336110ead282 in master (take latest), now you can use:

imgp TestProgressive.jpg --pr --keep

to avoid any transformation.

Or if you want optimization (enabled by default), just run:

imgp TestProgressive.jpg --pr

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jarun/imgp/issues/28#issuecomment-419690376, or mute the thread https://github.com/notifications/unsubscribe-auth/AIQ3E3Awe3haiom3RE-kLUSMGUTrkTXGks5uZJtKgaJpZM4WcTGz .

jarun commented 6 years ago

I think the options are simply to choose how many scans the image offers.

I checked the PIL docs for JPEG - https://pillow.readthedocs.io/en/5.1.x/handbook/image-file-formats.html#jpeg

I don't think there's any exposed way to specify the number of scans. So this is the best I could do.

jarun commented 6 years ago

Also, I took this image from Google: https://www.google.com/about/datacenters/gallery/images/_2000/IDI_018.jpg The source is a progressive image.

EXIF data from original and imgp-converted image:

~/G/imgp$ exiftool IDI_018.jpg 
ExifTool Version Number         : 10.10
File Name                       : IDI_018.jpg
Directory                       : .
File Size                       : 1140 kB
File Modification Date/Time     : 2018:09:09 10:29:03+05:30
File Access Date/Time           : 2018:09:09 10:29:17+05:30
File Inode Change Date/Time     : 2018:09:09 10:29:03+05:30
File Permissions                : rw-rw-r--
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Resolution Unit                 : None
X Resolution                    : 1
Y Resolution                    : 1
Image Width                     : 2000
Image Height                    : 1333
Encoding Process                : Progressive DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:4:4 (1 1)
Image Size                      : 2000x1333
Megapixels                      : 2.7

~/G/imgp$ exiftool IDI_018_IMGP.jpg 
ExifTool Version Number         : 10.10
File Name                       : IDI_018_IMGP.jpg
Directory                       : .
File Size                       : 455 kB
File Modification Date/Time     : 2018:09:09 10:29:18+05:30
File Access Date/Time           : 2018:09:09 10:30:33+05:30
File Inode Change Date/Time     : 2018:09:09 10:29:18+05:30
File Permissions                : rw-rw-r--
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Resolution Unit                 : None
X Resolution                    : 1
Y Resolution                    : 1
Image Width                     : 2000
Image Height                    : 1333
Encoding Process                : Progressive DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Image Size                      : 2000x1333
Megapixels                      : 2.7

As you can see, both the images show:

Encoding Process                : Progressive DCT, Huffman coding
motioncircus commented 6 years ago

Hi Arun,

Like I said, I wasn't doubting that you'd achieved it. I am just surprised that it's not visible in the results I've seen so far.

Please let me know how I can pay you.

Enjoy your weekend

Thanks again

Nigel

On Sun, 9 Sep. 2018, 3:05 pm Arun Prakash Jana, notifications@github.com wrote:

Also, I took this image from Google: https://www.google.com/about/datacenters/gallery/images/_2000/IDI_018.jpg The source is a progressive image.

EXIF data from original and imgp-converted image:

~/G/imgp$ exiftool IDI_018.jpg ExifTool Version Number : 10.10 File Name : IDI_018.jpg Directory : . File Size : 1140 kB File Modification Date/Time : 2018:09:09 10:29:03+05:30 File Access Date/Time : 2018:09:09 10:29:17+05:30 File Inode Change Date/Time : 2018:09:09 10:29:03+05:30 File Permissions : rw-rw-r-- File Type : JPEG File Type Extension : jpg MIME Type : image/jpeg JFIF Version : 1.01 Resolution Unit : None X Resolution : 1 Y Resolution : 1 Image Width : 2000 Image Height : 1333 Encoding Process : Progressive DCT, Huffman coding Bits Per Sample : 8 Color Components : 3 Y Cb Cr Sub Sampling : YCbCr4:4:4 (1 1) Image Size : 2000x1333 Megapixels : 2.7

~/G/imgp$ exiftool IDI_018_IMGP.jpg ExifTool Version Number : 10.10 File Name : IDI_018_IMGP.jpg Directory : . File Size : 455 kB File Modification Date/Time : 2018:09:09 10:29:18+05:30 File Access Date/Time : 2018:09:09 10:30:33+05:30 File Inode Change Date/Time : 2018:09:09 10:29:18+05:30 File Permissions : rw-rw-r-- File Type : JPEG File Type Extension : jpg MIME Type : image/jpeg JFIF Version : 1.01 Resolution Unit : None X Resolution : 1 Y Resolution : 1 Image Width : 2000 Image Height : 1333 Encoding Process : Progressive DCT, Huffman coding Bits Per Sample : 8 Color Components : 3 Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2) Image Size : 2000x1333 Megapixels : 2.7

As you can see, both the images show:

Encoding Process : Progressive DCT, Huffman coding

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jarun/imgp/issues/28#issuecomment-419691268, or mute the thread https://github.com/notifications/unsubscribe-auth/AIQ3E9Kniu6LKrAQKtIv5pZMXbL8Pl-bks5uZKGGgaJpZM4WcTGz .

jarun commented 6 years ago

Hi Nigel,

Thanks! Please use the PayPal donate button in the project page.

motioncircus commented 6 years ago

Payment made. Thanks again. You're very professional. Nigel

On Sun, 9 Sep. 2018, 3:55 pm Arun Prakash Jana, notifications@github.com wrote:

Hi Nigel,

Thanks! Please use the PayPal donate button in the project page.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jarun/imgp/issues/28#issuecomment-419692957, or mute the thread https://github.com/notifications/unsubscribe-auth/AIQ3E87V7R9udhx9G6YyITj_X_B1_omKks5uZK1QgaJpZM4WcTGz .

jarun commented 6 years ago

I have checked the PIL source as well. I does call the progressive option of the underlying library when the option is used: https://github.com/python-pillow/Pillow/blob/fdbd719da4c77c7e23e2e9e9b71d0d177f2d3369/src/libImaging/JpegEncode.c#L218

Also, you can get an idea on the type of progression used:

https://www4.cs.fau.de/Services/Doc/graphics/doc/jpeg/libjpeg.html search the function "jpeg_simple_progression" in this file for a description.

I will raise an issue on the PIL library to handle custom scan scripts if they can support it.

motioncircus commented 6 years ago

Nice work!

Very thorough of you Arun.

I look forward to working with you again sometime.

Do you have a resume of your skills online somewhere?

Nigel Nigel Haslam | Director

Motion Circus Pty Ltd. Byron Bay t: + 61 2 8007 7338 |m: + 61 403 020 126 w: www.motioncircus.com http://www.motioncircus.com/ link to website http://motioncircus.com

On Sun, Sep 9, 2018 at 4:14 PM Arun Prakash Jana notifications@github.com wrote:

I have checked the PIL source as well. I does call the progressive option of the underlying library when the option is used: https://github.com/python-pillow/Pillow/blob/fdbd719da4c77c7e23e2e9e9b71d0d177f2d3369/src/libImaging/JpegEncode.c#L218

Also, you can get and idea of the type of progression is used:

https://www4.cs.fau.de/Services/Doc/graphics/doc/jpeg/libjpeg.html search the function "jpeg_simple_progression" in this file for a description.

I will add the defect in the PIL library to support the number of scan script to check if they can support it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jarun/imgp/issues/28#issuecomment-419693592, or mute the thread https://github.com/notifications/unsubscribe-auth/AIQ3EzlYxumzHQ_gkkD60QnkOMb-4nFAks5uZLHEgaJpZM4WcTGz .

jarun commented 6 years ago

Thanks for the compliment Nigel!

Do you have a resume of your skills online somewhere?

Nope, nothing of that sort. I guess you can look me up on Google though.

The defect has been accepted as an enhancement: https://github.com/python-pillow/Pillow/issues/3343

motioncircus commented 6 years ago

That's great,

Please let me know if they inform you that it's been implemented.

N Nigel Haslam | Director

Motion Circus Pty Ltd. Byron Bay t: + 61 2 8007 7338 |m: + 61 403 020 126 w: www.motioncircus.com http://www.motioncircus.com/ link to website http://motioncircus.com

On Sun, Sep 9, 2018 at 10:15 PM Arun Prakash Jana notifications@github.com wrote:

Thanks for the compliment Nigel!

Do you have a resume of your skills online somewhere?

Nope, nothing of that sort. I guess you can look me up on Google though.

The defect has been accepted as an enhancement: python-pillow/Pillow#3343 https://github.com/python-pillow/Pillow/issues/3343

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jarun/imgp/issues/28#issuecomment-419711988, or mute the thread https://github.com/notifications/unsubscribe-auth/AIQ3E_HWK3Ncw3wCIiEBKjsOAyd0pwsOks5uZQZogaJpZM4WcTGz .

jarun commented 6 years ago

Sure thing!

kkopachev commented 6 years ago

Simple progression used by libjpeg already has 10 scans. There is a chance, however, that mobile phone, to save on decoding, waits for the whole image to only show it once it's done. You might want to use jpegtran with -scans option to pass custom scans script to try out if it makes any difference for your tests.

motioncircus commented 6 years ago

Hi Konstantin,

Thanks for your reply.

While I'm sure you are correct in the technical aspect, please compare the following images because I can clearly SEE A DIFFERENCE, which is what hope to achieve by using progressive scan method

Sample images A visibly 'progressing', progressive jpeg motioncircus.com/temp/2018_0911_213000.jpg

A progressive jpeg processed with libjpeg motioncircus.com/temp/TestProgressive_IMGP_V2.jpg

The source, scanline jpeg motioncircus.com/TestProgressive.jpg

I view these images in Chrome browser on a PC. I understand that mobile devices may differ in their presentation.

Thanks in advance Nigel

Nigel Haslam | Director

Motion Circus Pty Ltd. Byron Bay t: + 61 2 8007 7338 |m: + 61 403 020 126 w: www.motioncircus.com http://www.motioncircus.com/ link to website http://motioncircus.com

On Wed, Sep 12, 2018 at 5:03 AM Konstantin Kopachev < notifications@github.com> wrote:

Simple progression used by libjpeg already has 10 scans. There is a chance, however, that mobile phone, to save on decoding, waits for the whole image to only show it once it's done. You might want to use jpegtran with -scans option to pass custom scans script to try out if it makes any difference for your tests.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jarun/imgp/issues/28#issuecomment-420385649, or mute the thread https://github.com/notifications/unsubscribe-auth/AIQ3Ez7EUk7BKQ94W7-5CJ33IiPBFmQ_ks5uaAj9gaJpZM4WcTGz .

kkopachev commented 6 years ago

Oh, ok. First 2 images both have 10 scans total. They could be different configuration scans, though, but given amount of data each scan brings, I think they are the same. You might want to try jpegtran with custom scans file and see if what you want is achievable with more scans.

motioncircus commented 6 years ago

Hi Konstantin,

Thanks for your swift reply and insight.

I'm a novice in these matters but I will discuss your analysis with Arun, who is helping me figure this out.

Have a great day Nigel

Nigel Haslam | Director

Motion Circus Pty Ltd. Byron Bay t: + 61 2 8007 7338 |m: + 61 403 020 126 w: www.motioncircus.com http://www.motioncircus.com/ link to website http://motioncircus.com

On Wed, Sep 12, 2018 at 7:26 AM Konstantin Kopachev < notifications@github.com> wrote:

Oh, ok. First 2 images both have 10 scans total. They could be different configuration scans, though, but given amount of data each scan brings, I think they are the same. You might want to try jpegtran with custom scans file and see if what you want is achievable with more scans.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jarun/imgp/issues/28#issuecomment-420431119, or mute the thread https://github.com/notifications/unsubscribe-auth/AIQ3E4wJggKQduEw-jasEisDf7hqkNxUks5uaCpugaJpZM4WcTGz .

jarun commented 6 years ago

Oh, ok. First 2 images both have 10 scans total.

@kkopachev which utility are you using to detect the number of scans?

It would be great if I can have the support from the PIL library. I believe with jpegtran it would be enough to write a small script that runs on every file in a directory and changes the number of scans.

kkopachev commented 6 years ago

@jarun exiftool is probably easiest

exiftool -v3 2018_0911_213000.jpg | grep SOS`

I'd be happy to have Pillow support custom progressive scans too. I mentioned jpegtran just to test things and see if custom scans could do something to the problem.

jarun commented 6 years ago

Thank you!

jarun commented 6 years ago

Yes, I can see the default 10 scans set for an IMGP generated output file:

$ exiftool -v3 TestProgressive_IMGP.jpg |grep SOS
JPEG SOS
JPEG SOS
JPEG SOS
JPEG SOS
JPEG SOS
JPEG SOS
JPEG SOS
JPEG SOS
JPEG SOS
JPEG SOS