• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Watermarking Images on Catalina
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Watermarking Images on Catalina


  • Subject: Watermarking Images on Catalina
  • From: Jenni via AppleScript-Users <email@hidden>
  • Date: Thu, 9 Jul 2020 21:37:51 -0700

        Awhile back I wrote a script to watermark images using iMagine Photo.
Unfortunately the app no longer works under Catalina.  Does anyone know of
another app that will do watermarking?  I looked at the Image Events dictionary
but I didn’t see anything.

Thanks,
Frank




on watermark(water_mark_file, orig_image, wm_corner)
        set copyrightText to "© Company Name"
        set artistText to “Your Name Here"
        set new_filename to item 2 of parse_file(orig_image) & "." & item 3 of
parse_file(orig_image)
        set filepath to item 1 of parse_file(orig_image)

        --set amount_to_blend to get_integer("Enter the amount to blend as
Percentage (0-100): ", 20, 0, 100)
        set amount_to_blend to 20 as integer -- (% transparency)


        tell application "iMagine Photo.app"
                -- Import image and watermark and create a window to draw them
to.
                set waterMarkImporter to «event ASDsimGr» water_mark_file
                if the «class imEr» of waterMarkImporter is not equal to 0 then
                        close waterMarkImporter
                        return
                end if
                set thisImporter to «event ASDsimGr» orig_image

                (* Set copyright info *)
                set theProps to the «class iPdt» of thisImporter
                copy the «class GrTy» of theProps to graphicType

                tell thisImporter to «event ASDsmaEx» given «class
prdt»:{«class exFT»:"JPEG"}
                set the «class eFlc» of thisImporter to orig_image
                set the «class eExD» of thisImporter to {{«class
udTy»:«constant udTy©cpy», «class exUn»:copyrightText}, {«class udTy»:«constant
udTy©ART», «class exUn»:artistText}}

                if the «class imEr» of thisImporter is not equal to 0 then
                        close waterMarkImporter
                        return
                end if

                set {x, y, xDim, yDim} to the «class NBRe» of thisImporter
                set thisDocument to make new «class WiDo» with properties
{«class gWSz»:{xDim, yDim}}
                set the «class grDc» of thisImporter to thisDocument
                set the «class grDc» of waterMarkImporter to thisDocument

                «event ASDsdraw» thisImporter
                (*
                  Scaling and positioning code for the watermark.
                  The height of the watermark will be no taller than 1/3 the
height of the image.  See "divisor" variable.
                *)
                set {x, y, xWmDim, yWmDim} to the «class NBRe» of
waterMarkImporter
                set divisor to 4
                if xDim > yDim then
                        set fraction to xDim / divisor
                        if xWmDim ≤ fraction then
                                set the_scaler to 1
                        else
                                set the_scaler to fraction / xWmDim
                        end if
                else
                        set fraction to yDim / divisor
                        if yWmDim ≤ fraction then
                                set the_scaler to 1
                        else
                                set the_scaler to fraction / yWmDim
                        end if
                end if

                (* Since the watermark is now smaller, use the new size in
setting the position. *)
                set new_xWmDim to xWmDim * the_scaler
                set new_yWmDim to yWmDim * the_scaler
                set pixels_from_edge to 15

                if wm_corner is equal to "Top Left" then
                        set theTop to pixels_from_edge
                        set theLeft to pixels_from_edge
                else if wm_corner is equal to "Center Left" then
                        set theTop to ((yDim - new_yWmDim) / 2) as integer
                        set theLeft to pixels_from_edge
                else if wm_corner is equal to "Bottom Left" then
                        set theTop to yDim - new_yWmDim - pixels_from_edge
                        set theLeft to pixels_from_edge
                else if wm_corner is equal to "Top Middle" then
                        set theTop to pixels_from_edge
                        set theLeft to ((xDim - new_xWmDim) / 2) as integer
                else if wm_corner is equal to "Center Middle" then
                        set theTop to ((yDim - new_yWmDim) / 2) as integer
                        set theLeft to ((xDim - new_xWmDim) / 2) as integer
                else if wm_corner is equal to "Bottom Middle" then
                        set theTop to yDim - new_yWmDim - pixels_from_edge
                        set theLeft to ((xDim - new_xWmDim) / 2) as integer
                else if wm_corner is equal to "Top Right" then
                        set theTop to pixels_from_edge
                        set theLeft to xDim - new_xWmDim - pixels_from_edge
                else if wm_corner is equal to "Center Right" then
                        set theTop to ((yDim - new_yWmDim) / 2) as integer
                        set theLeft to xDim - new_xWmDim - pixels_from_edge
                else if wm_corner is equal to "Bottom Right" then
                        set theTop to yDim - new_yWmDim - pixels_from_edge
                        set theLeft to xDim - new_xWmDim - pixels_from_edge
                end if

                set the «class Scal» of waterMarkImporter to {the_scaler,
the_scaler}
                set the «class TLPt» of waterMarkImporter to {theLeft, theTop}
                set amount_to_blend to (amount_to_blend / 100) * 65535 as
integer
                set blendOpColor to {amount_to_blend, amount_to_blend,
amount_to_blend}
                set the «class drMd» of waterMarkImporter to {«class
grMd»:«constant grMd», «class opCo»:blendOpColor}
                «event ASDsdraw» waterMarkImporter
                set «class eFlc» of thisDocument to filepath & ":" &
new_filename
                set wm_image to filepath & ":" & new_filename
                «event ASDsxprt» thisDocument
                close thisDocument
                close thisImporter
                close waterMarkImporter
                quit
        end tell
        return wm_image
end watermark

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Watermarking Images on Catalina
      • From: Shane Stanley via AppleScript-Users <email@hidden>
  • Prev by Date: Re: Notarizing applets
  • Next by Date: Re: Watermarking Images on Catalina
  • Previous by thread: Re: Notarizing applets
  • Next by thread: Re: Watermarking Images on Catalina
  • Index(es):
    • Date
    • Thread