Sat Oct 02, 2021 1:02 am
Sat Oct 02, 2021 1:39 am
Sat Oct 02, 2021 1:53 am
ecs1749 wrote:This must be simple. I am simply trying to load my signature.png file to a new layer.
filename=r"signature.jpg"
layer = pdb.gimp_file_load_layer(image, filename)
and I tried:
filename=r"signature.png"
image = pdb.file_png_load(filename, filename)
and neither of them work. The new layer doesn't show up.
Sat Oct 02, 2021 4:01 am
ecs1749 wrote:This must be simple. I am simply trying to load my signature.png file to a new layer.
filename=r"signature.jpg"
layer = pdb.gimp_file_load_layer(image, filename)
and I tried:
filename=r"signature.png"
image = pdb.file_png_load(filename, filename)
and neither of them work. The new layer doesn't show up.
Sat Oct 02, 2021 4:36 am
Sat Oct 02, 2021 10:59 am
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from gimpfu import *
def open_an_image(filename):
img = pdb.gimp_image_new(1920, 1080, RGB)
imagLayer = pdb.gimp_file_load_layer(img, filename)
pdb.gimp_image_add_layer(img, imagLayer, 0)
#Center the image to the canvas
imagLayer.set_offsets((img.width - imagLayer.width) / 2, (img.height - imagLayer.height) / 2)
pdb.gimp_display_new(img)
register(
"open_an_image",
"Open any image", #Short description
"Open any type of image", #Long description
"Your name",
"Your name",
"2021",
"Open my favorite image", #This is how you want it to appear in GIMP menu
"",
[
(PF_FILENAME, "filename", "Image:", None), #Directory option
],
[],
open_an_image, menu="<Image>/Python-Fu/Open my favorite image"), #This is how you want it to appear in GIMP menu
main()
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#Above codings
#1. Python Source Code Encodings
#2. Most popular Python Source Code Encodings (Use both)
from gimpfu import * #This willgives you all of the constants, the procedural database (pdb), and gimp (Everything that belong to GIMP)
def open_an_image(filename): #Name of main function and variables
img = pdb.gimp_image_new(1920, 1080, RGB) #This function opens a new image with the size given and the image mode colors
imagLayer = pdb.gimp_file_load_layer(img, filename) #This will open or load image from directory
pdb.gimp_image_add_layer(img, imagLayer, 0) #Add or insert the layer for the image that it will open
#Center the image and make it big
factor = min (float(img.width) / imagLayer.width, float(img.height) / imagLayer.height)
imagLayer.scale(int(imagLayer.width * factor), int(imagLayer.height * factor))
imagLayer.set_offsets((img.width - imagLayer.width) / 2, (img.height - imagLayer.height) / 2)
pdb.gimp_display_new(img)
register(
"open_an_image",
"Open any image", #Short description
"Open any type of image", #Long description
"Your name",
"Your name",
"2021",
"Open my favorite image", #This is how you want it to appear in GIMP menu
"",
[
(PF_FILENAME, "filename", "Image:", None), #Directory option
],
[],
open_an_image, menu="<Image>/Python-Fu/Open my favorite image"), #This is how you want it to appear in GIMP menu
main()
Sat Oct 02, 2021 8:47 pm
Sat Oct 02, 2021 9:01 pm
Sat Oct 02, 2021 9:08 pm
ecs1749 wrote:Wow! Sallyanne, was that a screen shot you posted? How do you do that?
Sat Oct 02, 2021 9:10 pm
Sat Oct 02, 2021 9:14 pm
zeuspaul wrote:For screen shots in Gimp first I print screen from the keyboard. Alt print screen can also be used. Then I go to edit and paste as and choose new image.ecs1749 wrote:Wow! Sallyanne, was that a screen shot you posted? How do you do that?
Sat Oct 02, 2021 9:21 pm
ecs1749 wrote:I wish there is a easy way for me to post a screen shot. Sallyanne, was that a screen shot you posted? How do you do that?
Sat Oct 02, 2021 9:25 pm
sallyanne wrote:ecs1749 wrote:I wish there is a easy way for me to post a screen shot. Sallyanne, was that a screen shot you posted? How do you do that?
There is a way to do it in gimp, file > create > screenshot But I always do it this way - I find it quicker.
Print the screen and paste in gimp as a new image then crop to what you want to show. If you are wanting to show a drop down menu you need to click over it and hold your cursor over the area while you take your screen shot.
You may have to have an image open as some things are 'unavailable/greyed out' when there is no image.
Sat Oct 02, 2021 9:29 pm
Sat Oct 02, 2021 9:47 pm
Sat Oct 02, 2021 9:53 pm
ecs1749 wrote:Yes!!! That works. So, I have to explicitly add the new layer.
Thanks, everyone.
Sat Oct 02, 2021 10:10 pm
sallyanne wrote:Sorry ecs. After you have the screenshot in your clipboard, To paste that into gimp first you go to "Menu in Gimp"
Edit> Paste As> New Image
[ Image ]
To do with keys it has the shortcul there as well
Also, Have a look at this viewtopic.php?f=23&t=7695
I'm guessing you haven't posted a picture on the message boards yet? If you want to, click on the icon in between the speech icon and the web icon, hold your cursor over it and it will say upload file. Click on it and you will get another window where you have to browse for your file and then add it. - It needs to upload and then you submit it. It will only give a web address for now until you have posted your post. Then you will see your image. By the way the maximum size file is 5242880 bytes.