Script-fu resize images in directory - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP) +---- Forum: Scripting questions (https://www.gimp-forum.net/Forum-Scripting-questions) +---- Thread: Script-fu resize images in directory (/Thread-Script-fu-resize-images-in-directory) |
Script-fu resize images in directory - LightTunnelEtc - 07-31-2018 Hello all! First post here so I hope this make sense. I am trying to resize images to the highest multiple of 4 (unless it already is a multiple of 4). My script runs without any errors but does absolutely nothing to the images in the directory. I tested out individual elements of the script in the GIMP console (or whatever it is called) and the ones I could test work fine. I feel like I'm missing something simple. Any ideas? The script is below. Code: ; example pattern form because it starts in C: "/Users/Etc/*.png" RE: Script-fu resize images in directory - Ofnuts - 08-01-2018 "Does nothing": files are not updated? Or files are changed but the image has the same size? You can also use gimp-message to display the values of width/height just before resizing. RE: Script-fu resize images in directory - LightTunnelEtc - 08-01-2018 (08-01-2018, 12:53 PM)Ofnuts Wrote: "Does nothing": files are not updated? Or files are changed but the image has the same size? Thanks for the reply. The image is not being resized. I ran the script and it turns out it is actually changing the file (I'm just testing on one for now, in a folder). I ran it today and the file says date modified of August 1st, however the dimensions of the image did not change at all. I added some gimp-message statements and the intended new width and height are proper multiples of 4, so it seems the issue is with these lines: Code: (gimp-image-resize image width height 0 0) RE: Script-fu resize images in directory - Kevin - 08-01-2018 If I understand this correctly, you're resizing the image BUT leaving the layer (aka drawable) unchanged. So when you come to save the result, gimp-file-save is saving the drawable - which is unchanged. You might want to do gimp-layer-resize-to-image-size before saving. RE: Script-fu resize images in directory - Ofnuts - 08-01-2018 Got it... gimp-image-resize only resizes the canvas and not the layer(s) (like Image>Canvas size). gimp-file-save saves the layer, which hasn't been resized... So you would have to also use gimp-layer-resize-to-image-size. Another method is to resize the layer directly (and not the image). RE: Script-fu resize images in directory - LightTunnelEtc - 08-01-2018 I added, after resizing the image Code: (gimp-layer-resize-to-image-size drawable) and it works now! Thanks very much to you both! |