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

Request of GIMP "Zealous crop" demonstration code to be added in Python to the python dir #9

Open
HanalogInstruments opened this issue Jun 23, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@HanalogInstruments
Copy link

HanalogInstruments commented Jun 23, 2022

Hi,
Could you made the Zealous Crop of GIMP via python?

https://docs.gimp.org/2.10/en/plug-in-zealouscrop.html

I have some jpeg have gray border like this.

Also i wanna make it auto white balance and auto rorate fix

@ElectricRCAircraftGuy
Copy link
Owner

I may not get to this. If you are able to figure it out, post your code and let's have a look at your solution together.

@HanalogInstruments
Copy link
Author

HanalogInstruments commented Jun 25, 2022

I may not get to this. If you are able to figure it out, post your code and let's have a look at your solution together.

Hi,
Here is my code using pillow:

import os
import glob
for fname in glob.glob('./repaired/*.JPG'):
    im = Image.open(fname)
    im = ImageOps.crop(im, border=17)
    im = ImageOps.autocontrast(im, cutoff = 1)
    enhancer = ImageEnhance.Sharpness(im).enhance(3)
    #im = ImageOps.posterize(im, bits=8)
    #enhancer =  ImageEnhance.Color(im).enhance(3)
    im.save(fname, quality="maximum")
    print(fname)

@ElectricRCAircraftGuy
Copy link
Owner

ElectricRCAircraftGuy commented Jun 25, 2022

I get: NameError: name 'glob' is not defined. Can you please post a full, runnable code?

Also, post "before" and "after" images, and images of what Gimp does to the image via zelouscrop or whatever you do in Gimp, so we can see:

  1. original image
  2. desired post-processed image (from Gimp)
  3. actual post-processed image (from Python code).

You can copy-paste images directly into the comments here on GitHub. There is no need to use Google drive for your images.

I need all Python scripts you post to be fully runnable. Your code above is not. If I place it into a file, it does not run.

Note that I edited your comment above to properly format the code you pasted. Please click the edit button on the comment to see how I did that, so you can do that next time.

@ElectricRCAircraftGuy ElectricRCAircraftGuy changed the title Request of GIMP crop Request of GIMP "Zealous crop" demonstration code to be added in Python to the python dir Jun 25, 2022
@ElectricRCAircraftGuy ElectricRCAircraftGuy added the enhancement New feature or request label Jun 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants