So are there ways to work around this handicap? There are future plans by GIMP's developers to implement something similar to Smart Object functionality, but it's still some way off, unfortunately. Note that GIMP doesn't have any Smart Object functionality at present, so any template/mockup design created with GIMP will necessarily involve more manual work in order to use it, when compared to Photoshop mockups that use Smart Objects to automate placement/transforms of images. However, Photoshop doesn't support XCF files at all, so if you need to open it in Photoshop, then you would need to export the image as a PSD from GIMP. It's a lossless format, and it preserves all layers, and editable text layers.Īlthough GIMP also supports PSD to some degree, you should use XCF for full compatibility with GIMP. It's the format you should use to save your original work for future editability (whether it's being used as a template or not). One line of code just as he said: composite -gravity center smallImage.png bigImage.png output.Yes. Unless someone is holding a gun to your head and demands that you use GIMP, suggestion to use imagemagick should be accepted. (file-png-save RUN-NONINTERACTIVE image visible-layer output-file output-file 0 9 0 0 0 0 0) (visible-layer (car (gimp-layer-new-from-visible image image "visible"))) create a new layer from the visible layers of the image (gimp-image-insert-layer image overlay-layer 0 -1) (define (overlay-images image-file-1 image-file-2 output-file) Huge thanks to for pointing me in the right direction. That then shows smallImage.png in output.png so it isn't a file read error. I've tried swapping the two images: (overlay-images "/tmp/smallImage.png" "/tmp/bigImage.png" "/tmp/output.png") My expectations are that the second image (smallImage.png) appears roughly in the centre of the first (bigImage.png). (file-png-save RUN-NONINTERACTIVE image drawable output-file output-file 0 9 0 0 0 0 0) (gimp-message (string-append "Overlay layer visible before saving: " (if (= (car (gimp-drawable-get-visible overlay-layer)) TRUE) "yes" "no"))) (gimp-message (string-append "Number of layers before saving: " (number->string (car (gimp-image-get-layers image))))) (gimp-message (string-append "Overlay layer position: (" (number->string overlay-offset-x) ", " (number->string overlay-offset-y) ")")) (gimp-message (string-append "Overlay layer size: " (number->string (car (gimp-drawable-width overlay-layer))) "x" (number->string (car (gimp-drawable-height overlay-layer))))) (overlay-offset-y (cadr overlay-offsets)) (overlay-offsets (gimp-drawable-offsets overlay-layer)) (gimp-layer-set-offsets overlay-layer offset-x offset-y) (offset-y (/ (- image-height overlay-height) 2)) (offset-x (/ (- image-width overlay-width) 2)) (overlay-height (car (gimp-drawable-height overlay-layer))) (overlay-width (car (gimp-drawable-width overlay-layer))) (image-height (car (gimp-image-height image))) (image-width (car (gimp-image-width image))) (gimp-message (string-append "Overlay layer visible: " (if (= (car (gimp-drawable-get-visible overlay-layer)) TRUE) "yes" "no"))) (gimp-message (string-append "Number of layers: " (number->string (car (gimp-image-get-layers image))))) (gimp-image-add-layer image overlay-layer -1) (gimp-message (string-append "overlay-layer: " (number->string overlay-layer))) (overlay-layer (car (gimp-file-load-layer RUN-NONINTERACTIVE image image-file-2))) (drawable (car (gimp-image-get-active-layer image))) (image (car (file-png-load RUN-NONINTERACTIVE image-file-1 image-file-1))) Here is the script with the debugging I've been using to work out why the second image can't be seen in the output.png: (define (overlay-images image-file-1 image-file-2 output-file) (overlay-images "/tmp/bigImage.png" "/tmp/smallImage.png" "/tmp/output.png") The first image provided in the procedure call always shows, but the second image doesn't. I'm looking to automate the addition of a small PNG at the centre of a much larger PNG using GIMP (2.8) and its Script-Fu language.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |