Python Forum
Super Urgent, work related. Gimp Python - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Super Urgent, work related. Gimp Python (/thread-30384.html)



Super Urgent, work related. Gimp Python - tsurubaso - Oct-19-2020

Hello to all,
I wrote a little script some years ago.
it was beginning like this.



import gimp
import gimpfu
import os, glob
Today,
I add to use it.

And gimp library was not recognized.
As gimpfu.

I checked then
https://ibb.co/7470fNQ

pgimp 1.0.0a22

is the new gimp, may be???

It was crashing with elegance.

https://ibb.co/WpPSVy0

Then,

I have a work to do.

What ever solution you have, other program, other plug in...

Here is the program itself.

I am not a programmer, this is may be horrible to read, but the thing was working perfectly.
import gimp
import gimpfu
import os, glob
brightness = 20
contrast = 20

path = "C:\\test"
outdir = os.path.join(path, "output")
if not os.path.exists(outdir):
    os.mkdir(outdir)
	#de -127 a 127


for jpg in glob.glob(os.path.join(path, "*.HEIC")): #HEIC
	img = pdb.gimp_file_load(jpg, "")
	disp = pdb.gimp_display_new(img)
	
	drawable = pdb.gimp_image_get_active_layer(img)
	pdb.gimp_brightness_contrast(drawable,brightness,contrast)
	jpg=jpg[:-4]+"jpg"
	newjpg = os.path.join(outdir, os.path.basename(jpg))
	pdb.file_jpeg_save(img, img.active_layer, newjpg,".jpg", 1.0, 0.0, 0, 0, "", 2, 1, 0, 2)
	pdb.gimp_display_delete(disp)



RE: Super Urgent, work related. Gimp Python - bowlofred - Oct-19-2020

When you tried to install pgimp, it looks like the pip in your PATH is from an installation of python2, but pgimp requires python3.

You would need to be using pip from a python3 installation to install pgimp.


RE: Super Urgent, work related. Gimp Python - tsurubaso - Oct-19-2020

(Oct-19-2020, 05:57 AM)bowlofred Wrote: When you tried to install pgimp, it looks like the pip in your PATH is from an installation of python2, but pgimp requires python3.

You would need to be using pip from a python3 installation to install pgimp.

Hello,
thanks for your answer,
Also thanks for Gribouillis.

https://ibb.co/R7PJPCL

I have Python 3.

mmmm...

I don't understand.


RE: Super Urgent, work related. Gimp Python - bowlofred - Oct-19-2020

You can test. Run pip -V and see what the output is. It should show you the full path of the location it's running from.

If you have both 2 and 3 installed, try running instead pip3 -V. If that shows a version installed, you can use it to install your package.


RE: Super Urgent, work related. Gimp Python - tsurubaso - Oct-19-2020

(Oct-19-2020, 06:50 AM)bowlofred Wrote: You can test. Run pip -V and see what the output is. It should show you the full path of the location it's running from.

If you have both 2 and 3 installed, try running instead pip3 -V. If that shows a version installed, you can use it to install your package.

Hello bowlofred, I just upgraded pip.

I will do that and report pictures.

I will Edit.

Edit: Why on earth my computer go search my pip on my Blender installation.

https://ibb.co/QrYnynz

ahhhhh!! I erase Blender, this Python with it.


RE: Super Urgent, work related. Gimp Python - tsurubaso - Oct-19-2020

Understood,
No more pictures of code.

I was so panicking.

Sorry for the Admin.

Ok, problem solved.

Shame on me.

Gimp Have its own python included, like blender.

My IDE was sending error message because it have no connection with this Python version.