While DOpus has had image conversion and rotation for a long time, it doesn't appear to have a method for flipping images horizontally or vertically. Rotation, in and of itself, doesn't get the job done. Is there a way to do this within DOpus?
With scripting in DO11, is this now possible?
No, I don't think we expose that functionality.
I would make a button which runs a command-line image editing tool like ImageMagick, which should be able to do that kind of thing very easily.
I gave it a go Leo. Needless to say, it ain't working yet. My coding skills are minimal at best, but I'm willing to learn...
Here's what I have written:
[code]@language vbscript
option explicit
' Copy, flip and rename image(s) horizontally via ImageMagick's (IM) convert.exe protocol
Function OnClick (ByRef ClickData)
Dim cdf
Dim src
Dim sPath
Dim oldname
Dim newnamne
Dim imconvert
Dim imargs
Dim cmdstring
Set cdf = ClickData.func
Set src = cdf.sourcetab
sPath = src.path
oldname = src.name & "." & src.ext
imconvert = "C:\Program Files\ImageMagick-6.8.8-Q16\convert"
' string attached to the filename
const strAdd = "_flip_hor"
newname = oldname & strAdd & "." & src.ext
' IM uses following syntax:
' convert imagename.oldext -flip imagename.newext
imargs = str oldname & " -flip" & newname
cmdstring = imconvert & " " & imargs
' Flip image
With cdf.Command
.deselect = FALSE
.addline cmdstring
.run
End With
End Function[/code]
It doesn't do anything. Looking at it strictly from DOpus' perspective, am I scripting to call DOpus to do something correctly?
From ImageMagick's perspective, I might have an issue with the path based on the cmdstring syntax (maybe a quotes problem). If you're interested, here's the ImageMagick VBscript reference page.
From a quick look, you might need to put quotes around the EXE path. (Use "" within a quoted string in VBScript to add a quote into the string.)
We're thinking of adding a way to do this without needing an external program, too, by the way.
[quote="leo"]From a quick look, you might need to put quotes around the EXE path. (Use "" within a quoted string in VBScript to add a quote into the string.)
We're thinking of adding a way to do this without needing an external program, too, by the way.[/quote]
I definitely need the double quotes with the spaces in the path...
I've tried a few different variations with no luck. While you fine gents contemplate adding the functionality (which would be MOST WELCOME!), I'll keep plugging away to see if I can get it to work.
Is there a reason you're doing it with a script? Especially if you're not fluent in scripting, I'd have thought you would just create a standard Opus button that calls the exe with appropriate arguments and {f} for the filename...
I don't know that it can be done that way. The syntax through ImageMagick's (IM's) CLI is to call the program then use the following:
convert filename.ext -flip newfilename.ext (where newfilename.ext is optional)
How would one go through the method you mention given the file path & name must be called in the middle of IM's syntax? Something like this maybe:
Go "C:\Program Files\ImageMagick-6.8.8-Q16\convert.exe" convert {f} -flip
This simply opens that exe's directory since IM can't understand {f}. I even tried hard coding the direct path to the file; that didn't work either.
If it can be done that way, I'm more than happy to use it that way.
Beyond that, it's an exercise in trying to relearn some rudimentary scripting.
Short follow-up:
I was able to get it working as follows:
"C:\Program Files\ImageMagick-6.8.8-Q16\convert.exe" {filepath} -flip +repage "{sourcepath}{file|noext} - vflip{file|ext}"
Would still like to figure the script thing out, though...