Flow to inspect compression jpeg

Post Reply
ChristianK
Newbie
Posts: 15
Joined: Wed Nov 30, 2022 1:15 pm

Flow to inspect compression jpeg

Post by ChristianK »

Hi all, Happy New Year !!
Is there a way to made a flow to check compression level of jpeg file and sort files from the level ?
Best Regards,

I think maybe with imagemagick something like -format info but how to made it ?

Regards,
Christian
jan_suhr
Advanced member
Posts: 592
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Flow to inspect compression jpeg

Post by jan_suhr »

Image Magick has several programs that do or check stuff with images.

In this case you run the program idenify.exe (if on Windows) with the parameter -format '%Q' "path to jpeg"

This will return a value between 0 and 100 with 100 as highest quality.

You can easiest run this with the app Run Command and in the property command you enter this as a Single-line text with variables:
"C:/Program Files/ImageMagick-7.0.11-Q16-HDRI/identify.exe" -format '%Q' "[Job.Path]"

The path to your identify program may be different. Not that the variable for the job path must be in double quotes.

You will now get the JPEG quality value as a Private Data that you then can use to sort your images. This is in the property Standard output private data tag

https://www.enfocus.com/en/appstore/product/run-command
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
ChristianK
Newbie
Posts: 15
Joined: Wed Nov 30, 2022 1:15 pm

Re: Flow to inspect compression jpeg

Post by ChristianK »

Thanks Jan,
I made the flow as you describe, it works but i didn't have information ? and have error
How can I output information in text file ? or sort result if compression is low level ?

Thanks again for your hlep,
regards,
Christian
jpeg.png
jpeg.png (13.62 KiB) Viewed 226963 times
error.png
error.png (28.73 KiB) Viewed 226963 times
Attachments
Capture d’écran 2024-01-10 à 11.24.01.png
Capture d’écran 2024-01-10 à 11.24.01.png (108.25 KiB) Viewed 226963 times
ChristianK
Newbie
Posts: 15
Joined: Wed Nov 30, 2022 1:15 pm

Re: Flow to inspect compression jpeg

Post by ChristianK »

I try the flow available in Enocus Run Command but have error too ... didn't find the output folder seems to be the issue....
Capture d’écran 2024-01-10 à 11.38.16.png
Capture d’écran 2024-01-10 à 11.38.16.png (124.9 KiB) Viewed 226956 times
Capture d’écran 2024-01-10 à 11.39.29.png
Capture d’écran 2024-01-10 à 11.39.29.png (191.36 KiB) Viewed 226956 times
Capture d’écran 2024-01-10 à 11.40.14.png
Capture d’écran 2024-01-10 à 11.40.14.png (140.52 KiB) Viewed 226956 times
Regards, Christian
jan_suhr
Advanced member
Posts: 592
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Flow to inspect compression jpeg

Post by jan_suhr »

To be able to see the Private Data value you need to add one more folder to the flow and then Hold the connection between the last two folders.

All Metadata attached to a job is removed when the job arrives at the output folder (the last one)

Then you will see the value of the JPEG
Snag_2a096617.png
Snag_2a096617.png (48.32 KiB) Viewed 226955 times
You can then add several folders to the one after the Run command app. On each out put connection you can set rules based on the value.
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
ChristianK
Newbie
Posts: 15
Joined: Wed Nov 30, 2022 1:15 pm

Re: Flow to inspect compression jpeg

Post by ChristianK »

Thanks a lot, now I have result .... but wrong...
First I test my command in cmd , and I check some errors (path to DLL, I change it and it's good)
and have the result : jpeg compression is 99 : all works fine
Now I translate the command in switch : I have to made this :
"C:\Program Files\ImageMagick7\magick.exe" -format "%Q" "%%InputFilePath%%"
The flow works but image goes to Folder Jpeg quality smaller than 50...
I made why you explain ( add a folder, hold connection to see value) : the value is 0, so effectively image is in the right folder,
but it is not the right value....maybe the retrieving tag is wrong ?
Regards, Christian
Capture d’écran 2024-01-10 à 13.46.10.png
Capture d’écran 2024-01-10 à 13.46.10.png (141.22 KiB) Viewed 226913 times
Capture d’écran 2024-01-10 à 13.47.17.png
Capture d’écran 2024-01-10 à 13.47.17.png (21.7 KiB) Viewed 226913 times
Capture d’écran 2024-01-10 à 13.48.10.png
Capture d’écran 2024-01-10 à 13.48.10.png (150.71 KiB) Viewed 226913 times
ChristianK
Newbie
Posts: 15
Joined: Wed Nov 30, 2022 1:15 pm

Re: Flow to inspect compression jpeg

Post by ChristianK »

Maybe I know why I haven't informations : I have no module licence for metadata.....
Attachments
Capture d’écran 2024-01-10 à 14.18.15.png
Capture d’écran 2024-01-10 à 14.18.15.png (34.48 KiB) Viewed 226911 times
jan_suhr
Advanced member
Posts: 592
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Flow to inspect compression jpeg

Post by jan_suhr »

Well in this case it is only Private Data.

The Metadata Module handles XML, JSON and other Metadata inputs.

On your outgoing connections, right click and select this for the good ones
Snag_1671f8.png
Snag_1671f8.png (28.22 KiB) Viewed 226886 times
Then we have to specify the values that we accept for this connection.
Since the Private Data only appears as text we first have to get only the digits, this is the Search property and we looks for only digits ( \d ). With text can't use greater than or less than on this value. Instead we can use a RegExp to find text that is 50 or more. The first line will find anyhting from 50 to 99 and then we add one line if it is 100.
Snag_1885c5.png
Snag_1885c5.png (29.4 KiB) Viewed 226886 times
For the other connection we send All others
Snag_192e0b.png
Snag_192e0b.png (28.79 KiB) Viewed 226886 times
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
ChristianK
Newbie
Posts: 15
Joined: Wed Nov 30, 2022 1:15 pm

Re: Flow to inspect compression jpeg

Post by ChristianK »

OK i try this, can you please tell me how do you made to write in the right section of regexp conditions ?
Very best regards,
Christian
Capture d’écran 2024-01-10 à 17.20.51.png
Capture d’écran 2024-01-10 à 17.20.51.png (180.28 KiB) Viewed 226849 times
jan_suhr
Advanced member
Posts: 592
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Flow to inspect compression jpeg

Post by jan_suhr »

You have to click on the little > to the right and select "Inline value", after that you can write your RegExp
Snag_bf7e47.png
Snag_bf7e47.png (34.86 KiB) Viewed 226845 times
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
ChristianK
Newbie
Posts: 15
Joined: Wed Nov 30, 2022 1:15 pm

Re: Flow to inspect compression jpeg

Post by ChristianK »

it works ! It's what I'm doing but have to write the text before select match, otherwise I can't write the regexp

Thanks for your help, I'm testing now !
Best Regards,

Christian
ChristianK
Newbie
Posts: 15
Joined: Wed Nov 30, 2022 1:15 pm

Re: Flow to inspect compression jpeg

Post by ChristianK »

Hi,
Have tested but all my images test files with different compression level goes to the same output folder.....

By the way, I made a batch script that works and give me the value in a texte file for each images, not using Switch.
Capture d’écran 2024-01-11 à 16.33.36.png
Capture d’écran 2024-01-11 à 16.33.36.png (237.5 KiB) Viewed 225863 times
Capture d’écran 2024-01-11 à 16.35.45.png
Capture d’écran 2024-01-11 à 16.35.45.png (141.21 KiB) Viewed 225863 times
jan_suhr
Advanced member
Posts: 592
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Flow to inspect compression jpeg

Post by jan_suhr »

Yes of course they are all over 50 in Quality.
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
Post Reply