Hi everyone,
well, I read the FAQ and found a full example to cut out the known
(black) background.
Seems to work with png, but ... once I convert that fine picture to jpg
it produces one weird white spot on that black background.
Do I basically misunderstand something or do I miss out about the
parameters?
Any help appreciated.
Here is the way, I did it:
Option Explicit
On Error Resume Next
Const ERROR_SUCCESS = 0
Dim img
Dim info
Dim msgs
Dim elem
Dim sMsgs
'
' This is the simplest sample I could come up with. It creates
' the ImageMagick COM object and then sends a copy of the IM
' logo out to a JPEG image files on disk.
'
Set img = CreateObject("ImageMagickObject.MagickImage.1")
'
' The methods for the IM COM object are identical to utility
' command line utilities. You have convert, composite, identify,
' mogrify, and montage. We did not bother with animate, and
' display since they have no purpose in this context.
'
' The argument list is exactly the same as the utility programs
' as a list of strings. In fact you should just be able to
' copy and past - do simple editing and it will work. See the
' other samples for more elaborate command sequences and the
' documentation for the utility programs for more details.
'
'Format wandeln
msgs = img.mogrify("-format","png","c:\bild\bild1.jpg")
'Hintergrund transparent
msgs =
img.Convert("c:\bild\bild1.png","-matte","-fill","none","-draw","matte
0,0 floodfill","c:\bild\bild2.png")
'Hintergrund weiss
msgs =
img.Convert("c:\bild\bild2.png","-background","White","-flatten","c:\bild\bild3.png")
' By default - the string returned is the height, width, and the
' type of the image that was output. You can control this using
' the -format "xxxxxx" command as documented by identify.
'
If Err.Number <> ERROR_SUCCESS Then ShowError: WScript.Quit
MsgBox "info: " & msgs
Set img=Nothing
WScript.Quit(0)
Sub ShowError
sMsgs = ""
If BasicError(Err.Number) > 5000 Then
sMsgs = " ImageMagickObject" & vbCrLf
End If
WScript.Echo Err.Number & ": " & Err.Description & vbCrLf & sMsgs
End Sub
Function BasicError(e)
BasicError = e And &HFFFF&
End Function
Regards,
Jörg Feierabend
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users