kud / jpegrescan

JPEGrescan: losslessly shrink any JPEG file - YOU PROBABLY SHOULD USE MozJPEG https://github.com/mozilla/mozjpeg
Other
187 stars 23 forks source link

Fatal error when jpegrescan loops thru an array #13

Open smalenshek opened 10 years ago

smalenshek commented 10 years ago

I’m a little embarrassed that I have not figured this issue out, but I have looked at it so long that it has become a scenario of “not seeing the forest for all the trees”.

I have a customer that has around 48K+ images that are all within a recursive hierarchy. In order to make things work, I modified your script that you have created to allow for looping thru an array of paths to the images. The first always completes correctly, but the second fails every time. The following is the output that I am seeing.

/virtuals/tmp/media/pickadoll-logo.jpg --> /virtuals/tmp/media2/pickadoll-logo.jpg ............... 12238 --> 11728 -4.17% /virtuals/tmp/media/images/about_us_main_1.jpg --> /virtuals/tmp/media2/images/about_us_main_1.jpg ................Invalid progressive parameters at scan script entry 5 Died at jpegOptimize.pl line 149.

I have attempted to modify the failing image individually and it is successful. I removed the first result you see in the example, thus making the one in the example that failed the first, and it was successful and the second again fails.

I am assuming that this is something related to variable not clearing from the previous optimization, but I am just not finding it.

Any assistance that can be offered would be sincerely appreciated.

Korbik commented 10 years ago

It is hard to help without seeing the modifications you have done around your script to process your images collection.

Regards

smalenshek commented 10 years ago

Sorry… I have not had a chance to place it in a repository. Here is the file. Let me know if you have any questions and thanks for taking the time to look at it.

Stephen Malenshek

Sr. Practice Architect

SLM Labs, LLC

E-Mail: smalenshek@slmlabs.com mailto:smalenshek@slmlabs.com

Phone: (479) 226-8290

Mobile: (479) 285-3437

From: Korbik [mailto:notifications@github.com] Sent: Wednesday, June 4, 2014 17:15 To: kud/jpegrescan Cc: Stephen Malenshek Subject: Re: [jpegrescan] Fatal error when jpegrescan loops thru an array (#13)

It is hard to help without seeing the modifications you have done around your script to process your images collection.

Regards

— Reply to this email directly or view it on GitHub https://github.com/kud/jpegrescan/issues/13#issuecomment-45159036 . https://github.com/notifications/beacon/942634__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxNzUzOTMwOSwiZGF0YSI6eyJpZCI6MzM4NzY1ODd9fQ==--802dcc570ecdc2364f96b13977115bd9293ccd57.gif

Korbik commented 10 years ago

Sorry but I can't see the file jpegOptimize.pl

smalenshek commented 10 years ago

Strange… Use this URL. http://chemistdirect.slmlabs.com/jpegOptimize.pl

Once you retrieve it, I will pull it off.

Stephen Malenshek

Sr. Practice Architect

SLM Labs, LLC

E-Mail: smalenshek@slmlabs.com mailto:smalenshek@slmlabs.com

Phone: (479) 226-8290

Mobile: (479) 285-3437

From: Korbik [mailto:notifications@github.com] Sent: Wednesday, June 4, 2014 17:24 To: kud/jpegrescan Cc: Stephen Malenshek Subject: Re: [jpegrescan] Fatal error when jpegrescan loops thru an array (#13)

Sorry but I can't see the file jpegOptimize.pl

— Reply to this email directly or view it on GitHub https://github.com/kud/jpegrescan/issues/13#issuecomment-45159794 . https://github.com/notifications/beacon/942634__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxNzUzOTgxMywiZGF0YSI6eyJpZCI6MzM4NzY1ODd9fQ==--07b58884d659bab474d278796731ad71b3a9fc6c.gif

kornelski commented 10 years ago

Instead of modifying the script, you could just run it from another tool, e.g. ImageOptim on mac or:

find . -name \*.jpg -print0 | xargs -0 -P8 -n1 jpegrescan
smalenshek commented 10 years ago

Ok… Just a second. Let me try that.

Stephen Malenshek

Sr. Practice Architect

SLM Labs, LLC

E-Mail: smalenshek@slmlabs.com mailto:smalenshek@slmlabs.com

Phone: (479) 226-8290

Mobile: (479) 285-3437

From: Kornel [mailto:notifications@github.com] Sent: Wednesday, June 4, 2014 17:40 To: kud/jpegrescan Cc: Stephen Malenshek Subject: Re: [jpegrescan] Fatal error when jpegrescan loops thru an array (#13)

Instead of modifying the script, you could just run it from another tool, e.g. ImageOptim on mac or:

find . -name *.jpg -print0 | xargs -0 -P8 -n1 jpegrescan

— Reply to this email directly or view it on GitHub https://github.com/kud/jpegrescan/issues/13#issuecomment-45161392 . https://github.com/notifications/beacon/942634__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxNzU0MDgyNSwiZGF0YSI6eyJpZCI6MzM4NzY1ODd9fQ==--f843849bd4c493ff80c964c48c87773141ddeedf.gif

Korbik commented 10 years ago

I'm only a beginner in Perl so it is not easy. I have a question : " Why are you creating a script in perl around the original script (jpegrescan.pl) when you could create a walking script in perl as you have done and call the jpegrescan.pl script inside ?"

smalenshek commented 10 years ago

The problem is that jpegrescan requires an input and output file location for this to all work. In running the command set you provided, it was failing out because it did not have an output file location instead of just updating in place.

Stephen Malenshek

Sr. Practice Architect

SLM Labs, LLC

E-Mail: smalenshek@slmlabs.com mailto:smalenshek@slmlabs.com

Phone: (479) 226-8290

Mobile: (479) 285-3437

From: Korbik [mailto:notifications@github.com] Sent: Wednesday, June 4, 2014 17:51 To: kud/jpegrescan Cc: Stephen Malenshek Subject: Re: [jpegrescan] Fatal error when jpegrescan loops thru an array (#13)

I'm only a beginner in Perl so it is not easy. I have a question : " Why are you creating a script in perl around the original script (jpegrescan.pl) when you could create a walking script in perl as you have done and call the jpegrescan.pl script inside ?"

— Reply to this email directly or view it on GitHub https://github.com/kud/jpegrescan/issues/13#issuecomment-45162319 . https://github.com/notifications/beacon/942634__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxNzU0MTQ3NiwiZGF0YSI6eyJpZCI6MzM4NzY1ODd9fQ==--1f037cead5b285a1f134efb21a111f7a112da20b.gif

smalenshek commented 10 years ago

One other thing to your question… The script has just been renamed because of the amount of functionality that has been added. You can do a diff and see the differences, but they are essentially the same.

Stephen Malenshek

Sr. Practice Architect

SLM Labs, LLC

E-Mail: smalenshek@slmlabs.com mailto:smalenshek@slmlabs.com

Phone: (479) 226-8290

Mobile: (479) 285-3437

From: Korbik [mailto:notifications@github.com] Sent: Wednesday, June 4, 2014 17:51 To: kud/jpegrescan Cc: Stephen Malenshek Subject: Re: [jpegrescan] Fatal error when jpegrescan loops thru an array (#13)

I'm only a beginner in Perl so it is not easy. I have a question : " Why are you creating a script in perl around the original script (jpegrescan.pl) when you could create a walking script in perl as you have done and call the jpegrescan.pl script inside ?"

— Reply to this email directly or view it on GitHub https://github.com/kud/jpegrescan/issues/13#issuecomment-45162319 . https://github.com/notifications/beacon/942634__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxNzU0MTQ3NiwiZGF0YSI6eyJpZCI6MzM4NzY1ODd9fQ==--1f037cead5b285a1f134efb21a111f7a112da20b.gif

ajslater commented 10 years ago

You all might like picopt. It uses jpegrescan preferentially to optimize jpegs.

https://github.com/ajslater/picopt

Also ImgOpt for an all-in-one GUI Mac solution.

On Wed, Jun 4, 2014 at 3:55 PM, Stephen Malenshek notifications@github.com wrote:

One other thing to your question… The script has just been renamed because of the amount of functionality that has been added. You can do a diff and see the differences, but they are essentially the same.

Stephen Malenshek

Sr. Practice Architect

SLM Labs, LLC

E-Mail: smalenshek@slmlabs.com mailto:smalenshek@slmlabs.com

Phone: (479) 226-8290

Mobile: (479) 285-3437

From: Korbik [mailto:notifications@github.com] Sent: Wednesday, June 4, 2014 17:51 To: kud/jpegrescan Cc: Stephen Malenshek Subject: Re: [jpegrescan] Fatal error when jpegrescan loops thru an array (#13)

I'm only a beginner in Perl so it is not easy. I have a question : " Why are you creating a script in perl around the original script ( jpegrescan.pl) when you could create a walking script in perl as you have done and call the jpegrescan.pl script inside ?"

— Reply to this email directly or view it on GitHub < https://github.com/kud/jpegrescan/issues/13#issuecomment-45162319> . < https://github.com/notifications/beacon/942634__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxNzU0MTQ3NiwiZGF0YSI6eyJpZCI6MzM4NzY1ODd9fQ==--1f037cead5b285a1f134efb21a111f7a112da20b.gif>

Reply to this email directly or view it on GitHub https://github.com/kud/jpegrescan/issues/13#issuecomment-45162619.