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

jpegtran errors with "Invalid crop request" #92

Closed
jens-arnold opened this issue May 3, 2021 · 12 comments
Closed

jpegtran errors with "Invalid crop request" #92

jens-arnold opened this issue May 3, 2021 · 12 comments

Comments

@jens-arnold
Copy link

Both when using the file browser to select images to crop and when passing (relative or absolute) paths from the command line, cropgui shows the image and you can select the crop area, but when trying to crop, it doesn't work. It just prints a message to the console that the file wasn't found.
The only working method (and only if just the folder names contain space but not the filename) is to cd into the directory containing the files, and then calling cropgui with a relative path (i.e. just the filename).

@howff
Copy link

howff commented May 14, 2021

The code has been written to crop filenames with spaces

subprocess.call(command)

I can see this might fail if subprocess.call() defaulted to using shell=True, but the default is shell=False so it should work. Could you try changing it to subprocess.call(command, shell=False) and see if that improves it?

@klartext
Copy link

Tried croppiung a file with a space in it, and it worked.
Repeated this with a file with sapces inside a dir with spaces.
Worked also.
My\ Dir/My\ File.jpg
could be cropped.

I think this issue can be closed.

@klartext
Copy link

Correction: I tested it with cropgtk.py

@klartext
Copy link

Same result with cropgui.py

@fenugrec
Copy link

I seem to be having that problem , but... not all the time ? I was able to crop 1 out of 6 files in a certain folder. Others failed with "Error: file not found"... and the path contains a space for all of those.

@fenugrec
Copy link

fenugrec commented Nov 19, 2022

nice jpegtran -copy all -crop 2639fx2076f+704+320 -outfile /home/....../IMG_20220717_133230913-crop.jpg /home/..../IMG_20220717_133230913.jpg
Invalid crop request
rotation 1 -> 1
image_rotation None
Error: File not found - /home/...../IMG_20220717_133230913-crop.jpg

Ah, but what does "Invalid crop request" mean ? and does it have anything to do with the "File not found" error ?

@howff
Copy link

howff commented Nov 19, 2022

I suspect it is failing to crop - do the "f" characters in the dimension string have something to do with it?

@jepler
Copy link
Owner

jepler commented Nov 19, 2022

I was also noticing the "f" characters. On Debian this is supported in jpegtran from libjpeg-turbo-progs and was apparently added circa 2013 (in 1.2.90 (1.3 beta1)) and is noted as being ported from "jpeg-8d". The submitter of that feature also had it on their system, but maybe it's not everywhere.

If you're comfortable using the command-line, can you try "jpegtran -version"? mine prints libjpeg-turbo version 2.0.6 (build 20210314). Manually doing a crop at the commandline using the "f" syntax could help determine if this is unsupported in your version of jpegtran.

So at first we have jpegtran probably failing with "invalid crop request", possibly due to the unsupported "f" syntax; then, exiftool fails. That's the kind of message I get when it does:

$ exiftool -overwrite_original -Orientation=1 nope.jpg
Error: File not found - nope.jpg
    0 image files updated
    1 files weren't updated due to errors

since a failed jpegtran wouldn't create an output file.

I'm not thrilled about the idea of sniffing jpegtran versions ...

@fenugrec
Copy link

thanks.

"jpegtran -version"

libjpeg-turbo version 2.1.4 (build 20220816

either the 'f' is indigestible or the crop dims are larger than the image ? (thinking of #100 here )

@jepler jepler added the needinfo label Jun 7, 2024
@jepler jepler changed the title cropgui does not properly handle paths containing spaces jpegtran errors with "Invalid crop request" Jun 7, 2024
@jepler
Copy link
Owner

jepler commented Jun 7, 2024

Can you attach a specific image that fails, along with the exact jpegtran command line show in the terminal window?

What OS are you using?

@fenugrec
Copy link

fenugrec commented Jun 9, 2024

Hi,
I think since #104 was merged ( I don't remember seeing the Invalid crop request in a long time), I don't recall having further issues. While I didn't open this ticket, as far as I'm concerned it's "fixed until further notice"

@jepler
Copy link
Owner

jepler commented Jun 9, 2024

Thanks, closing issue.

@jepler jepler closed this as completed Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants