Wrapper for the ImageMagick lib

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Wrapper for the ImageMagick lib

Post by IdeasVacuum »

ImageMagick has a huge range of image processing functions (photoshop effects for example).
Features and Capabilities

There are ImageMagick interfaces for a number of languages, including Ada, C, COM+, C++, Java, Lisp, Lua, .NET, Pascal, Perl, PHP, Python Ruby and Tcl/TK. There is also an OLE control for VB Script, VB and Windows Script Host.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Wrapper for the ImageMagick lib

Post by Little John »

I like this suggestion.
Or maybe GraphicsMagick could/should be utilized instead (which is quite similar to ImageMagick, but accoeding to its website seems to have some advantages).
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Wrapper for the ImageMagick lib

Post by davido »

+1
DE AA EB
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2137
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: Wrapper for the ImageMagick lib

Post by Andre »

+1

Sounds to good to extend PB's image processing functionality.
And there seems to be no licence problems to include it in PB, while it supports Windows, MacOS and Linux as well.
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
Ulix
User
User
Posts: 48
Joined: Wed Jan 23, 2008 12:45 pm
Location: France, Montpellier

Re: Wrapper for the ImageMagick lib

Post by Ulix »

Google translation :

+1

Additional question:

The current limit images is 8192 * 8192 pixels (see statement: LoadImage, createImage ... etc)
This limit is she still in force?


En Francais :

+1

Question supplémentaire :

La limite actuelle des images est de 8192*8192 pixels (voir instruction: loadImage, createImage... etc)
Cette limite sera t-elle encore en vigueur ?

A+
Ulix
marroh
User
User
Posts: 72
Joined: Wed Aug 06, 2008 8:21 am

Re: Wrapper for the ImageMagick lib

Post by marroh »

+1 :!:
PureBASIC v5.41 LTS , Windows v8.1 x64
Forget UNICODE - Keep it BASIC !
infratec
Always Here
Always Here
Posts: 7588
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Wrapper for the ImageMagick lib

Post by infratec »

If someone has time

MagicCore should be the best start point:

http://www.imagemagick.org/script/magick-core.php

Since it is for pure C it is only a question of time to write a wrapper.

Bernd
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Wrapper for the ImageMagick lib

Post by Little John »

Since GraphicsMagick seems to be better than ImageMagick (see my post above), it's probably better to look here: :-)

http://www.graphicsmagick.org/api/api.html
infratec
Always Here
Always Here
Posts: 7588
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Wrapper for the ImageMagick lib

Post by infratec »

A bit of time and here is a startpoint:

Code: Select all

;
; GraphicsMagick 1.3.23
;


CompilerIf #PB_Compiler_IsMainFile
  EnableExplicit
CompilerEndIf


Enumeration ChannelType
  #UndefinedChannel
  #RedChannel       ; RGB Red channel
  #CyanChannel      ; CMYK Cyan channel
  #GreenChannel     ; RGB Green channel
  #MagentaChannel   ; CMYK Magenta channel
  #BlueChannel      ; RGB Blue channel
  #YellowChannel    ; CMYK Yellow channel
  #OpacityChannel   ; Opacity channel
  #BlackChannel     ; CMYK Black (K) channel
  #MatteChannel     ; Same As Opacity channel (deprecated)
  #AllChannels      ; Color channels
  #GrayChannel      ; Color channels represent an intensity.
EndEnumeration


Enumeration ClassType
  #UndefinedClass   ; Unset value.
  #DirectClass      ; Image is composed of pixels which represent literal color values.
  #PseudoClass      ; Image is composed of pixels which specify an index in a color palette.
EndEnumeration


Enumeration ClipPathUnits
  #UserSpace
  #UserSpaceOnUse
  #ObjectBoundingBox
EndEnumeration


Enumeration ColorspaceType
  #UndefinedColorspace    ; Unset value.
  #RGBColorspace          ; Red, Green, Blue colorspace.
  #GRAYColorspace         ; Similar To Luma (Y) according To ITU-R 601
  #TransparentColorspace  ; RGB which preserves the matte While quantizing colors.
  #OHTAColorspace
  #XYZColorspace          ; CIE XYZ
  #YCCColorspace          ; Kodak PhotoCD PhotoYCC
  #YIQColorspace
  #YPbPrColorspace
  #YUVColorspace          ; YUV colorspace As used For computer video.
  #CMYKColorspace         ; Cyan, Magenta, Yellow, Black colorspace.
  #sRGBColorspace         ; Kodak PhotoCD sRGB
  #HSLColorspace          ; Hue, saturation, luminosity
  #HWBColorspace          ; Hue, whiteness, blackness
  #LABColorspace          ; ITU LAB
  #CineonLogRGBColorspace ; RGB Data With Cineon Log scaling, 2.048 density range
  #Rec601LumaColorspace   ; Luma (Y) according To ITU-R 601
  #Rec601YCbCrColorspace  ; YCbCr according To ITU-R 601
  #Rec709LumaColorspace   ; Luma (Y) according To ITU-R 709
  #Rec709YCbCrColorspace  ; YCbCr according To ITU-R 709
EndEnumeration



Enumeration ComplianceType
  #UndefinedCompliance = $0000
  #NoCompliance = $0000
  #SVGCompliance = $0001
  #X11Compliance = $0002
  #XPMCompliance = $0004
  #AllCompliance = $ffff
EndEnumeration


Enumeration CompositeOperator
  #UndefinedCompositeOp     ; Unset value.
  #OverCompositeOp          ; The result is the union of the the two image shapes With the composite image obscuring image in the region of overlap.
  #InCompositeOp            ; The result is a simply composite image cut by the shape of image. None of the image Data of image is included in the result.
  #OutCompositeOp           ; The resulting image is composite image With the shape of image cut out.
  #AtopCompositeOp          ; The result is the same shape As image image, With composite image obscuring image there the image shapes overlap. Note that this differs from OverCompositeOp because the portion of composite image outside of image's shape does not appear in the result.
  #XorCompositeOp           ; The result is the image Data from both composite image And image that is outside the overlap region. The overlap region will be blank.
  #PlusCompositeOp          ; The result is just the sum of the image Data. Output values are cropped To 255 (no overflow). This operation is independent of the matte channels.
  #MinusCompositeOp         ; The result of composite image - image, With overflow cropped To zero. The matte chanel is ignored (set To 255, full coverage).
  #AddCompositeOp           ; The result of composite image + image, With overflow wrapping around (mod 256).
  #SubtractCompositeOp      ; The result of composite image - image, With underflow wrapping around (mod 256). The add And subtract operators can be used To perform reversible transformations.
  #DifferenceCompositeOp    ; The result of Abs(composite image - image). This is useful For comparing two very similar images.
  #BumpmapCompositeOp       ; The result image shaded by composite image.
  #CopyCompositeOp          ; The resulting image is image replaced With composite image. Here the matte information is ignored.
  #CopyRedCompositeOp       ; The resulting image is the red layer in image replaced With the red layer in composite image. The other layers are copied untouched.
  #CopyGreenCompositeOp     ; The resulting image is the green layer in image replaced With the green layer in composite image. The other layers are copied untouched.
  #CopyBlueCompositeOp      ; The resulting image is the blue layer in image replaced With the blue layer in composite image. The other layers are copied untouched.
  #CopyOpacityCompositeOp   ; The resulting image is the matte layer in image replaced With the matte layer in composite image. The other layers are copied untouched.
  #ClearCompositeOp         ; Pixels in the region are set To Transparent.
  #DissolveCompositeOp
  #DisplaceCompositeOp
  #ModulateCompositeOp      ; Modulate brightness in HSL space.
  #ThresholdCompositeOp
  #NoCompositeOp            ; Do nothing at all.
  #DarkenCompositeOp
  #LightenCompositeOp
  #HueCompositeOp           ; Copy Hue channel (from HSL colorspace).
  #SaturateCompositeOp      ; Copy Saturation channel (from HSL colorspace).
  #ColorizeCompositeOp      ; Copy Hue And Saturation channels (from HSL colorspace).
  #LuminizeCompositeOp      ; Copy Brightness channel (from HSL colorspace).
  #ScreenCompositeOp        ; [Not yet implemented]
  #OverlayCompositeOp       ; [Not yet implemented]
  #CopyCyanCompositeOp      ; Copy the Cyan channel.
  #CopyMagentaCompositeOp   ; Copy the Magenta channel.
  #CopyYellowCompositeOp    ; Copy the Yellow channel.
  #CopyBlackCompositeOp     ; Copy the Black channel.
  #DivideCompositeOp
EndEnumeration


Enumeration CompressionType
  #UndefinedCompression     ; Unset value.
  #NoCompression            ; No compression
  #BZipCompression          ; BZip (Burrows-Wheeler block-sorting text compression algorithm And Huffman coding) As used by bzip2 utilities
  #FaxCompression           ; CCITT Group 3 FAX compression
  #Group4Compression        ; CCITT Group 4 FAX compression (used only For TIFF)
  #JPEGCompression          ; JPEG compression
  #LosslessJPEGCompression  ; Lossless JPEG compression
  #LZWCompression           ; Lempel-Ziv-Welch (LZW) compression (caution, patented by Unisys)
  #RLECompression           ; Run-Length encoded (RLE) compression
  #ZipCompression           ; Lempel-Ziv compression (LZ77) As used in PKZIP And GNU gzip.
EndEnumeration


Enumeration DecorationType
  #NoDecoration
  #UnderlineDecoration
  #OverlineDecoration
  #LineThroughDecoration
EndEnumeration


Enumeration EndianType
  #UndefinedEndian
  #LSBEndian        ; "little" endian
  #MSBEndian        ; "big" endian
  #NativeEndian     ; native endian
EndEnumeration



Enumeration ExceptionType
  #UndefinedException
  #WarningException = 300
  #ResourceLimitWarning = 300
  #TypeWarning = 305
  #OptionWarning = 310
  #DelegateWarning = 315
  #MissingDelegateWarning = 320
  #CorruptImageWarning = 325
  #FileOpenWarning = 330
  #BlobWarning = 335
  #StreamWarning = 340
  #CacheWarning = 345
  #CoderWarning = 350
  #ModuleWarning = 355
  #DrawWarning = 360
  #ImageWarning = 365
  #XServerWarning = 380
  #MonitorWarning = 385
  #RegistryWarning = 390
  #ConfigureWarning = 395
  #ErrorException = 400
  #ResourceLimitError = 400
  #TypeError = 405
  #OptionError = 410
  #DelegateError = 415
  #MissingDelegateError = 420
  #CorruptImageError = 425
  #FileOpenError = 430
  #BlobError = 435
  #StreamError = 440
  #CacheError = 445
  #CoderError = 450
  #ModuleError = 455
  #DrawError = 460
  #ImageError = 465
  #XServerError = 480
  #MonitorError = 485
  #RegistryError = 490
  #ConfigureError = 495
  #FatalErrorException = 700
  #ResourceLimitFatalError = 700
  #TypeFatalError = 705
  #OptionFatalError = 710
  #DelegateFatalError = 715
  #MissingDelegateFatalError = 720
  #CorruptImageFatalError = 725
  #FileOpenFatalError = 730
  #BlobFatalError = 735
  #StreamFatalError = 740
  #CacheFatalError = 745
  #CoderFatalError = 750
  #ModuleFatalError = 755
  #DrawFatalError = 760
  #ImageFatalError = 765
  #XServerFatalError = 780
  #MonitorFatalError = 785
  #RegistryFatalError = 790
  #ConfigureFatalError = 795
EndEnumeration


Enumeration FillRule
  #UndefinedRule
  #EvenOddRule
  #NonZeroRule
EndEnumeration


Enumeration FilterTypes
  #UndefinedFilter  ; Unset value.
  #PointFilter      ; Point Filter
  #BoxFilter        ; Box Filter
  #TriangleFilter   ; Triangle Filter
  #HermiteFilter    ; Hermite Filter
  #HanningFilter    ; Hanning Filter
  #HammingFilter    ; Hamming Filter
  #BlackmanFilter   ; Blackman Filter
  #GaussianFilter   ; Gaussian Filter
  #QuadraticFilter  ; Quadratic Filter
  #CubicFilter      ; Cubic Filter
  #CatromFilter     ; Catrom Filter
  #MitchellFilter   ; Mitchell Filter
  #LanczosFilter    ; Lanczos Filter
  #BesselFilter     ; Bessel Filter
  #SincFilter       ; Sinc Filter
EndEnumeration


Enumeration GravityType
  #ForgetGravity    ; Don't use gravity.
  #NorthWestGravity ; Position object at top-left of region.
  #NorthGravity     ; Postiion object at top-center of region
  #NorthEastGravity ; Position object at top-right of region
  #WestGravity      ; Position object at left-center of region
  #CenterGravity    ; Position object at center of region
  #EastGravity      ; Position object at right-center of region
  #SouthWestGravity ; Position object at left-bottom of region
  #SouthGravity     ; Position object at bottom-center of region
  #SouthEastGravity ; Position object at bottom-right of region
EndEnumeration


Enumeration ImageType
  #UndefinedType        ; Unset value.
  #BilevelType          ; Monochrome image
  #GrayscaleType        ; Grayscale image
  #PaletteType          ; Indexed color (palette) image
  #PaletteMatteType     ; Indexed color (palette) image With opacity
  #TrueColorType        ; Truecolor image
  #TrueColorMatteType   ; Truecolor image With opacity
  #ColorSeparationType  ; Cyan/Yellow/Magenta/Black (CYMK) image
EndEnumeration


Enumeration InterlaceType
  #UndefinedInterlace   ; Unset value.
  #NoInterlace          ; Don't interlace image (RGBRGBRGBRGBRGBRGB...)
  #LineInterlace        ; Use scanline interlacing (RRR...GGG...BBB...RRR...GGG...BBB...)
  #PlaneInterlace       ; Use plane interlacing (RRRRRR...GGGGGG...BBBBBB...)
  #PartitionInterlace   ; Similar To plane interlaing except that the different planes are saved To individual files (e.g. image.R, image.G, And image.B)
EndEnumeration


Enumeration LayerType
  #UndefinedLayer   ; Unset value.
  #RedLayer         ; Select red layer
  #GreenLayer       ; Select green layer
  #BlueLayer        ; Select blue layer
  #MatteLayer       ; Select matte (opacity values) layer
EndEnumeration


Enumeration NoiseType
  #UniformNoise                 ; Uniform noise
  #GaussianNoise                ; Gaussian noise
  #MultiplicativeGaussianNoise  ; Multiplicative Gaussian noise
  #ImpulseNoise                 ; Impulse noise
  #LaplacianNoise               ; Laplacian noise
  #PoissonNoise                 ; Poisson noise
EndEnumeration

Enumeration OrientationType
  #UndefinedOrientation     ; Unknown 	      Unknown
  #TopLeftOrientation       ; Left To right 	Top To bottom
  #TopRightOrientation      ; Right To left 	Top To bottom
  #BottomRightOrientation   ; Right To left 	Bottom To top
  #BottomLeftOrientation    ; Left To right 	Bottom To top
  #LeftTopOrientation       ; Top To bottom 	Left To right
  #RightTopOrientation      ; Top To bottom 	Right To left
  #RightBottomOrientation   ; Bottom To top 	Right To left
  #LeftBottomOrientation    ; Bottom To top 	Left To right
EndEnumeration


Enumeration PaintMethode
  #PointMethod          ; Replace pixel color at point.
  #ReplaceMethod        ; Replace color For all image pixels matching color at point.
  #FloodfillMethod      ; Replace color For pixels surrounding point Until encountering pixel that fails To match color at point.
  #FillToBorderMethod   ; Replace color For pixels surrounding point Until encountering pixels matching border color.
  #ResetMethod          ; Replace colors For all pixels in image With pen color.
EndEnumeration


Enumeration RGBAImageQuantums
  #IndexQuantum     ; PseudoColor colormap indices (valid only For image With colormap)
  #RedQuantum       ; Red pixel Quantum
  #GreenQuantum     ; Green pixel Quantum
  #BlueQuantum      ; Blue pixel Quantum
  #OpacityQuantum   ; Opacity (Alpha) Quantum
EndEnumeration


Enumeration CMYKImageQuantums
  #CyanQuantum      ; Cyan pixel Quantum
  #MagentaQuantum   ; Magenta pixel Quantum
  #YellowQuantum    ; Yellow pixel Quantum
  #BlackQuantum     ; Black pixel Quantum
EndEnumeration


Enumeration GrayScaleImageQuantums
  #GrayQuantum        ; Gray pixel
  #GrayOpacityQuantum ; Pixel opacity
EndEnumeration


Enumeration EntirePixels
  #RGBQuantum   ; RGB pixel (24 Or 48 octets)
  #RGBAQuantum  ; RGBA pixel (32 Or 64 octets)
  #CMYKQuantum  ; CMYK pixel (32 Or 64 octets)
EndEnumeration


Enumeration RegistryType
  #UndefinedRegistryType
  #ImageRegistryType
  #ImageInfoRegistryType
EndEnumeration


Enumeration RenderingIntent
  #UndefinedIntent    ; Unset value.
  #SaturationIntent 	; A rendering intent that specifies the saturation of the pixels in the image is preserved perhaps at the expense of accuracy in hue And lightness.
  #PerceptualIntent 	; A rendering intent that specifies the full gamut of the image is compressed Or expanded To fill the gamut of the destination device. Gray balance is preserved but colorimetric accuracy might Not be preserved.
  #AbsoluteIntent 	  ; Absolute colorimetric
  #RelativeIntent 	  ; Relative colorimetric
EndEnumeration


Enumeration ResolutionType
  #UndefinedResolution 	          ; Unset value.
  #PixelsPerInchResolution 	      ; Density specifications are specified in units of pixels per inch (english units).
  #PixelsPerCentimeterResolution 	; Density specifications are specified in units of pixels per centimeter (metric units).
EndEnumeration


Enumeration ResourceType
  #UndefinedResource
  #FileResource
  #MemoryResource
  #MapResource
  #DiskResource
EndEnumeration


Enumeration StorageType
  #CharPixel
  #ShortPixel
  #IntegerPixel
  #LongPixel
  #FloatPixel
  #DoublePixel
EndEnumeration


Enumeration StretchType
  #NormalStretch
  #UltraCondensedStretch
  #ExtraCondensedStretch
  #CondensedStretch
  #SemiCondensedStretch
  #SemiExpandedStretch
  #ExpandedStretch
  #ExtraExpandedStretch
  #UltraExpandedStretch
  #AnyStretch
EndEnumeration


Enumeration StyleType
  #NormalStyle
  #ItalicStyle
  #ObliqueStyle
  #AnyStyle
EndEnumeration


Enumeration VirtualPixelMethod
  #UndefinedVirtualPixelMethod
  #ConstantVirtualPixelMethod
  #EdgeVirtualPixelMethod
  #MirrorVirtualPixelMethod
  #TileVirtualPixelMethod
EndEnumeration


Enumeration MagickXColormapType
  #UndefinedColormap
  #PrivateColormap
  #SharedColormap
EndEnumeration


Enumeration TimerState
  #UndefinedTimerState
  #StoppedTimerState
  #RunningTimerState
EndEnumeration




Structure GraphicsMagick_Timer Align #PB_Structure_AlignC
  start.d
  stop.d
  total.d
EndStructure


Structure TimerInfo Align #PB_Structure_AlignC
  user.GraphicsMagick_Timer
  elapsed.GraphicsMagick_Timer
  
  state.l
  
  signature.l
EndStructure


Structure SegmentInfo
  x1.d
  y1.d
  x2.d
  y2.d
EndStructure

#SignatureSize = 64

Structure SignatureInfo
  digest.l[8]
  low_order.l
  high_order.l
  
  offset.l
  
  message.a[#SignatureSize]
EndStructure


Structure RectangleInfo Align #PB_Structure_AlignC
  width.l 	; Rectangle width
  height.l  ;	Rectangle height
  x.l       ; Rectangle horizontal offset
  y.l       ; Rectangle vertical offset
EndStructure


Structure PixelPacket Align #PB_Structure_AlignC
  red.a
  green.a
  blue.a
  opacity.a
EndStructure


Structure PixelPacket16 Align #PB_Structure_AlignC
  red.u
  green.u
  blue.u
  opacity.u
EndStructure


Structure PointInfo
  x.d
  y.d
  z.d
EndStructure


Structure ProfileInfo
  length.i
  *info
EndStructure



Structure AffineMatrix
  sx.d
  rx.d
  ry.d
  sy.d
  tx.d
  ty.d
EndStructure


Structure ColorPacket Align #PB_Structure_AlignC
  pixel.PixelPacket
  index.u
  count.l
EndStructure


Structure ErrorInfo
  mean_error_per_pixel.d      ; Average error per pixel (absolute range)
  normalized_mean_error.d     ; Average error per pixel (normalized To 1.0)
  normalized_maximum_error.d  ; Maximum error encountered (normalized to 1.0)
EndStructure


Structure ExceptionInfo
  ;  Exception severity, reason, And description
  
  severity.i
  
  *reason
  *description
  
  ;  Value of errno (Or equivalent) when exception was thrown.
  error_number.i
  
  ;  Reporting source Module, function (If available), And source Module line.
  *module
  *function
  
  line.l
  
  signature.l
EndStructure


Structure FrameInfo Align #PB_Structure_AlignC
  width.l
  height.l
  x.l
  y.l
  inner_bevel.l
  outer_bevel.l
EndStructure


#MaxTextExtent = 2053

Structure MontageInfo
  *geometry
  *tile
  *title
  *frame
  *texture
  *font
  pointsize.d
  border_width.l
  shadow.i
  
  fill.PixelPacket
  stroke.PixelPacket
  background_color.PixelPacket
  border_color.PixelPacket
  matte_color.PixelPacket
  
  gravity.i
  
  filename.a[#MaxTextExtent]
  
  signature.l
EndStructure


Structure TypeMetric
  pixels_per_em.PointInfo

  ascent.d
  descent.d
  width.d
  height.d
  max_advance.d

  bounds.SegmentInfo
  
  underline_position.d
  underline_thickness.d
EndStructure


Structure ImageCharacteristics
  cmyk.l        ; CMYK(A) image
  grayscale.l   ; Grayscale image
  monochrome.l  ; Black/white image
  opaque.l      ; Opaque image
  palette.l     ; Colormapped image
EndStructure


Structure PrimaryInfo Align #PB_Structure_AlignC
  x.d
  y.d
  z.d
EndStructure


Structure ChromaticityInfo Align #PB_Structure_AlignC
  red_primary.PrimaryInfo
  green_primary.PrimaryInfo
  blue_primary.PrimaryInfo
  white_point.PrimaryInfo
EndStructure


Structure XResourceInfo
  resource_database.l
  
  *image_info.GraphicsMagick_ImageInfo

  *quantize_info.QuantizeInfo

  colors.l

  close_server.l
  backdrop.l

  *background_color
  *border_color
  
  *client_name

  colormap.l

  border_width.l
  color_recovery.l
  confirm_exit.l
  delay.l

  *display_gamma

  *font
  *font_name
  *foreground_color
  
  display_warnings.l
  gamma_correct.l

  *icon_geometry
  
  iconic.l
  immutable.l
  
  *image_geometry

  *map_type
  *matte_color
  *name

  magnify.l
  pause.l
  *pen_colors
  
  *text_font
  *title

  quantum.l
  
  update.l
  use_pixmap.l
  use_shared_memory.l
  
  undo_cache.l
  
  
  *visual_type
  *window_group
  *window_id
  *write_filename
  
  *copy_image.Image
  
  gravity.l

  home_directory.a[#MaxTextExtent]
EndStructure


Structure GraphicsMagick_ImageInfo Align #PB_Structure_AlignC
  compression.l     ; Image compression to use while decoding

  temporary.l       ; Remove file "filename" once it has been Read.
  adjoin.l          ; If True, join multiple frames into one file
  antialias.l       ; If True, antialias while rendering
  
  subimage.l        ; Starting image scene ID To Select
  subrange.l        ; Span of image scene IDs (from starting scene) To Select
  depth.l           ; Number of quantum bits to preserve while encoding
  
  *size             ; Desired/known dimensions To use when decoding image
  *tile             ; Deprecated, name of image To tile on background
  *page             ; Output page size & offset
  
  interlace.l       ; Interlace scheme to use when decoding image

  endian.l          ; Select MSB/LSB endian output for TIFF format

  units.l           ; Units to apply when evaluating the density option

  quality.l         ; Compression quality factor (format specific)

  *sampling_factor  ; JPEG, MPEG, And YUV chroma downsample factor
  *server_name      ; X11 server display specification
  *font             ; Font name To use For text annotations
  *texture          ; Name of texture image To use For background fills
  *density          ; Image resolution (also see units)

  pointsize.d       ; Font pointsize

  fuzz.d            ; Colors within this distance are a match

  
  pen.PixelPacket   ; Stroke Or fill color While drawing
  background_color.PixelPacket  ; Background color
  border_color.PixelPacket      ; Border color (color surrounding frame)
  matte_color.PixelPacket       ; Matte color (frame color)

  dither.l          ; If true, dither image While writing
  monochrome.l      ; If true, use monochrome format
  progress.l        ; If true, show progress indication

  colorspace.l      ; Colorspace representations of image pixels

  type.l            ; Desired image type (used while reading or writing)
  
  group.l           ; X11 window group ID

  verbose.l         ; If non-zero, display high-level processing
  
  *view             ; FlashPIX view specification
  *authenticate     ; Password used to decrypt file
  
  *client_data      ; User-specified data to pass to coder

  *file             ; If not null, stdio FILE * to read image from
                    ; (fopen mode "rb") Or write image To (fopen mode "rb+").

  magick.a[#MaxTextExtent]    ; File format To Read. Overrides file extension
  filename.a[#MaxTextExtent]  ; File name to read
  
  ; Only private members appear past this point

  *cache            ; Private. Used to pass image via open cache

  *definitions      ; Private. Map of coder specific options passed by user.
                    ; Use AddDefinitions, RemoveDefinitions, & AccessDefinition
                    ; To access And manipulate this Data.
  
  *attributes       ; Private. Image attribute list

  ping.l            ; Private, if true, read file header only

  preview_type.l    ; Private, used by PreviewImage

  affirm.l          ; Private, when true do not intuit image format

  *blob             ; Private, used to pass in open blob

  length.l          ; Private, used to pass in open blob length

  unique.a[#MaxTextExtent]  ; Private, passes temporary filename To TranslateText
  zero.a[#MaxTextExtent]    ; Private, passes temporary filename to TranslateText
  
  signature.l       ; Private, used to validate structure
EndStructure



Structure GraphicsMagick_Image Align #PB_Structure_AlignC
  storage_class.l   ; DirectClass (TrueColor) or PseudoClass (colormapped)
  
  colorspace.l      ; Current image colorspace/model
  
  compression.l     ; Compression algorithm to use when encoding image
  
  dither.l          ; True If image is To be dithered
  matte.l           ; True if image has an opacity (alpha) channel
  
  columns.l         ; Number of image columns
  rows.l            ; Number of image rows
  
  colors.l          ; Current number of colors in PseudoClass colormap
  depth.l           ; Bits of precision to preserve in color quantum
  
  *colormap.PixelPacket ; Pseudoclass colormap array
  
  background_color.PixelPacket  ; Background color
  border_color.PixelPacket      ; Border color
  matte_color.PixelPacket       ; Matte (transparent) color
  
  gamma.d           ; Image gamma (e.g. 0.45)
  
  chromaticity.ChromaticityInfo ; Red, green, blue, And white chromaticity values
  
  orientation.l     ; Image orientation
  
  rendering_intent.l  ; Rendering intent
  
  units.l           ; Units of image resolution (density)
  
  *montage          ; Tile size And offset within an image montage
  *directory        ; Tile names from within an image montage
  *geometry         ; Composite/Crop options
  
  offset.l          ; Offset to start of image data
  
  x_resolution.d    ; Horizontal resolution (also see units)
  y_resolution.d    ; Vertical resolution (also see units)
  
  page.RectangleInfo        ; Offset To apply when placing image
  tile_info.RectangleInfo   ; Subregion tile dimensions and offset
  
  blur.d            ; Amount of blur To apply when zooming image
  fuzz.d            ; Colors within this distance match target color
  
  filter.l          ; Filter to use when zooming image
  
  interlace.l       ; Interlace pattern to use when writing image
  
  endian.l          ; Byte order to use when writing image
  
  gravity.l         ; Image placement gravity
  
  compose.l         ; Image placement composition (default OverCompositeOp)
  
  dispose.l         ; GIF disposal option
  
  scene.l           ; Animation frame scene number
  delay.l           ; Animation frame scene delay
  iterations.l      ; Animation iterations
  total_colors.l    ; Number of unique colors. See GetNumberColors()
  
  start_loop.l      ; Animation frame number to start looping at
  
  error.ErrorInfo   ; Computed image comparison or quantization error
  
  timer.TimerInfo   ; Operation micro-timer
  
  *client_data      ; User specified opaque data pointer
  
  ;
  ;  Output file name.
  ;
  ;  A colon delimited format identifier may be prepended To the file
  ;  name in order To force a particular output format. Otherwise the
  ;  file extension is used. If no format prefix Or file extension is
  ;  present, then the output format is determined by the 'magick'
  ;  field.
  
  filename.a[#MaxTextExtent]
  
  ;
  ;  Original file name (name of input image file)
  
  magick_filename.a[#MaxTextExtent]
  
  ;
  ;  File format of the input file, And the Default output format.
  ;
  ;  The precedence when selecting the output format is:
  ;    1) magick prefix To file name (e.g. "jpeg:foo).
  ;    2) file name extension. (e.g. "foo.jpg")
  ;    3) content of this magick field.
  ;
  
  magick.a[#MaxTextExtent]
  
  ;
  ;  Original image width (before transformations)
  
  magick_columns.l
  
  ;
  ;  Original image height (before transformations)
  
  magick_rows.l
  
  exception.ExceptionInfo   ; Any error associated with this image frame
  
  *previous.GraphicsMagick_Image  ; Pointer To previous frame
  *next.GraphicsMagick_Image      ; Pointer to next frame
  
  ; To be added here For a later release:
  ;
  ;  quality?
  ;  subsampling
  ;  video black/white setup levels (ReferenceBlack/ReferenceWhite)
  ;  sample format (integer/float)
  
  ;  Only private members appear past this point
  
                    ; Private, Embedded profiles
  *profiles         ;
  
  is_monochrome.l   ; Private, True If image is known To be monochrome
  is_grayscale.l    ; Private, True If image is known To be grayscale
  taint.l           ; Private, True if image has not been modifed
  
  *clip_mask.GraphicsMagick_Image ; Private, Clipping mask to apply when updating pixels
  
  ping.l            ; Private, if true, pixels are undefined
  
  *cache            ; Private, image pixel cache
  
  *default_views    ; Private, default cache views
  
  *attributes       ; Private, Image attribute List
  
  *ascii85          ; Private, supports huffman encoding
  
  *blob             ; Private, file I/O object
  
  reference_count.l ; Private, Image reference count
  
  *semaphore        ; Private, Per image lock (for reference count)
  
  logging.l         ; Private, True if logging is enabled
  
  *list.GraphicsMagick_Image  ; Private, used only by display
  
  signature.l       ; Private, Unique code to validate structure
EndStructure




Global GraphicsMagick
Global GraphicsMagick_Filename$


CompilerSelect #PB_Compiler_OS
  CompilerCase #PB_OS_Windows
    GraphicsMagick_Filename$ = "CORE_RL_magick_.dll"
    Macro OSPrototype
     Prototype
    EndMacro
  CompilerCase #PB_OS_Linux
    GraphicsMagick_Filename$ = "GraphicsMagick.so.1"
    Macro OSPrototype
     PrototypeC
    EndMacro
  CompilerCase #PB_OS_MacOS
    GraphicsMagick_Filename$ = "GraphicsMagick.so.1"
    Macro OSPrototype
     PrototypeC
    EndMacro
CompilerEndSelect



;-Prototypes
; AccessCacheViewPixels
; AccessDefaultCacheView
; AccessDefinition
; AccessImmutableIndexes
; AccessMutableIndexes
; AccessMutablePixels
; AccessThreadViewData
; AccessThreadViewDataById
; AcquireCacheView
; AcquireCacheViewIndexes
; AcquireCacheViewPixels
; AcquireImagePixels
; AcquireMagickRandomKernel
; AcquireMagickResource
; AcquireMemory
; AcquireOneCacheViewPixel
; AcquireOnePixel
; AcquireOnePixelByReference
; AcquireSemaphoreInfo
; AcquireString
; AcquireTemporaryFileDescriptor
; AcquireTemporaryFileName
; AcquireTemporaryFileStream
; AdaptiveThresholdImage
; AddDefinition
; AddDefinitions
; AddNoiseImage
; AddNoiseImageChannel
; AffineTransformImage
; AllocateImage
; AllocateImageColormap
; AllocateImageProfileIterator
; AllocateNextImage
; AllocateSemaphoreInfo
; AllocateString
; AllocateThreadViewDataArray
; AllocateThreadViewDataSet
; AllocateThreadViewSet
; AnimateImageCommand
; AnimateImages
; AnnotateImage
; AppendImageFormat
; AppendImageProfile
; AppendImageToList
; AppendImages
; Ascii85Encode
; Ascii85Flush
; Ascii85Initialize
; Ascii85WriteByteHook
; AssignThreadViewData
; AttachBlob
; AutoOrientImage
; AverageImages
; BackgroundColor
; Base64Decode
; Base64Encode
; BenchmarkImageCommand
; BlackThresholdImage
; BlobIsSeekable
; BlobModeToString
; BlobReserveSize
; BlobToFile
; BlobToImage
; BlobWriteByteHook
; BlurImage
; BlurImageChannel
; BorderColor
OSPrototype.i Prototype_BorderImage(*image.GraphicsMagick_Image, *border_info.RectangleInfo, *exception.ExceptionInfo)
; CatchException
; CatchImageException
; CdlImage
; ChannelImage
; ChannelThresholdImage
; ChannelTypeToString
; CharcoalImage
; CheckImagePixelLimits
OSPrototype.i Prototype_ChopImage(*image.GraphicsMagick_Image, *chop_info.RectangleInfo, *exception.ExceptionInfo)
; ClassTypeToString
; ClipImage
; ClipPathImage
; CloneBlobInfo
; CloneDrawInfo
OSPrototype.i Prototype_CloneImage(*image.GraphicsMagick_Image, columns.l, rows.l, orphan.l, *exception.ExceptionInfo)
; CloneImageAttributes
OSPrototype.i Prototype_CloneImageInfo(*image_info.GraphicsMagick_ImageInfo)
; CloneImageList
; CloneMemory
; CloneMontageInfo
; CloneQuantizeInfo
; CloneString
; CloseBlob
; CloseCacheView
; CoalesceImages
; ColorFloodfillImage
; ColorMatrixImage
; ColorizeImage
; ColorspaceTypeToString
; CompareImageCommand
; CompositeImage
; CompositeImageCommand
; CompositeImageRegion
; CompositeOperatorToString
; CompressImageColormap
; CompressionTypeToString
; ConcatenateString
; ConfirmAccessModeToString
; ConjureImageCommand
; ConstituteImage
; ConstituteTextureImage
; ContinueTimer
; Contrast
; ContrastImage
; ConvertImageCommand
; ConvolveImage
; CopyException
OSPrototype.i Prototype_CropImage(*image.GraphicsMagick_Image, *geometry.RectangleInfo, *exception.ExceptionInfo)
; CropImageToHBITMAP
; CycleColormapImage
; DeallocateImageProfileIterator
; DeconstructImages
; DefaultCompressionQuality
; DefaultTileFrame
; DefaultTileGeometry
; DefaultTileLabel
; DefineClientName
; DefineClientPathAndName
; DeleteImageFromList
; DeleteImageProfile
; DeleteMagickRegistry
; DescribeImage
; DespeckleImage
; DestroyBlob
; DestroyBlobInfo
; DestroyColorInfo
; DestroyConstitute
; DestroyDelegateInfo
; DestroyDrawInfo
; DestroyExceptionInfo
OSPrototype Prototype_DestroyImage(*image.GraphicsMagick_Image)
; DestroyImageAttributes
OSPrototype Prototype_DestroyImageInfo(*imageInfo.GraphicsMagick_ImageInfo)
; DestroyImageList
; DestroyImagePixels
; DestroyLogInfo
; DestroyMagicInfo
OSPrototype Prototype_DestroyMagick()
; DestroyMagickModules
; DestroyMagickResources
; DestroyModuleInfo
; DestroyMontageInfo
; DestroyQuantizeInfo
; DestroySemaphore
; DestroySemaphoreInfo
; DestroyTemporaryFiles
; DestroyThreadViewDataSet
; DestroyThreadViewSet
; DestroyTypeInfo
; DetachBlob
; DifferenceImage
; DisassociateBlob
; DispatchImage
; DisplayImageCommand
; DisplayImages
; DrawAffine
; DrawAffineImage
; DrawAllocateContext
; DrawAnnotation
; DrawArc
; DrawBezier
; DrawCircle
; DrawClipPath
; DrawColor
; DrawComment
; DrawComposite
; DrawDestroyContext
; DrawEllipse
; DrawGetClipPath
; DrawGetClipRule
; DrawGetClipUnits
; DrawGetFillColor
; DrawGetFillOpacity
; DrawGetFillRule
; DrawGetFont
; DrawGetFontFamily
; DrawGetFontSize
; DrawGetFontStretch
; DrawGetFontStyle
; DrawGetFontWeight
; DrawGetGravity
; DrawGetStrokeAntialias
; DrawGetStrokeColor
; DrawGetStrokeDashArray
; DrawGetStrokeDashOffset
; DrawGetStrokeLineCap
; DrawGetStrokeLineJoin
; DrawGetStrokeMiterLimit
; DrawGetStrokeOpacity
; DrawGetStrokeWidth
; DrawGetTextAntialias
; DrawGetTextDecoration
; DrawGetTextEncoding
; DrawGetTextUnderColor
; DrawImage
; DrawLine
; DrawMatte
; DrawPathClose
; DrawPathCurveToAbsolute
; DrawPathCurveToQuadraticBezierAbsolute
; DrawPathCurveToQuadraticBezierRelative
; DrawPathCurveToQuadraticBezierSmoothAbsolute
; DrawPathCurveToQuadraticBezierSmoothRelative
; DrawPathCurveToRelative
; DrawPathCurveToSmoothAbsolute
; DrawPathCurveToSmoothRelative
; DrawPathEllipticArcAbsolute
; DrawPathEllipticArcRelative
; DrawPathFinish
; DrawPathLineToAbsolute
; DrawPathLineToHorizontalAbsolute
; DrawPathLineToHorizontalRelative
; DrawPathLineToRelative
; DrawPathLineToVerticalAbsolute
; DrawPathLineToVerticalRelative
; DrawPathMoveToAbsolute
; DrawPathMoveToRelative
; DrawPathStart
; DrawPatternPath
; DrawPeekGraphicContext
; DrawPoint
; DrawPolygon
; DrawPolyline
; DrawPopClipPath
; DrawPopDefs
; DrawPopGraphicContext
; DrawPopPattern
; DrawPushClipPath
; DrawPushDefs
; DrawPushGraphicContext
; DrawPushPattern
; DrawRectangle
; DrawRender
; DrawRotate
; DrawRoundRectangle
; DrawScale
; DrawSetClipPath
; DrawSetClipRule
; DrawSetClipUnits
; DrawSetFillColor
; DrawSetFillColorString
; DrawSetFillOpacity
; DrawSetFillPatternURL
; DrawSetFillRule
; DrawSetFont
; DrawSetFontFamily
; DrawSetFontSize
; DrawSetFontStretch
; DrawSetFontStyle
; DrawSetFontWeight
; DrawSetGravity
; DrawSetStrokeAntialias
; DrawSetStrokeColor
; DrawSetStrokeColorString
; DrawSetStrokeDashArray
; DrawSetStrokeDashOffset
; DrawSetStrokeLineCap
; DrawSetStrokeLineJoin
; DrawSetStrokeMiterLimit
; DrawSetStrokeOpacity
; DrawSetStrokePatternURL
; DrawSetStrokeWidth
; DrawSetTextAntialias
; DrawSetTextDecoration
; DrawSetTextEncoding
; DrawSetTextUnderColor
; DrawSetTextUnderColorString
; DrawSetViewbox
; DrawSkewX
; DrawSkewY
; DrawTranslate
; EOFBlob
; EdgeImage
; EmbossImage
; EndianTypeToString
; EnhanceImage
; EqualizeImage
; EscapeString
; ExecuteModuleProcess
; ExecuteStaticModuleProcess
; Exit
; ExpandAffine
; ExpandFilename
; ExpandFilenames
; ExportImageChannel
; ExportImagePixelArea
; ExportPixelAreaOptionsInit
; ExportViewPixelArea
OSPrototype.i Prototype_ExtentImage(*image.GraphicsMagick_Image, *geometry.RectangleInfo, *exception.ExceptionInfo)
; FileToBlob
; FinalizeSignature
; FlattenImages
OSPrototype.i Prototype_FlipImage(*image.GraphicsMagick_Image, *exception.ExceptionInfo)
OSPrototype.i Prototype_FlopImage(*image.GraphicsMagick_Image, *exception.ExceptionInfo)
; ForegroundColor
; FormatSize
; FormatString
; FormatStringList
OSPrototype.i Prototype_FrameImage(*image.GraphicsMagick_Image, *frame_info.FrameInfo, *exception.ExceptionInfo)
; FuzzyColorMatch
; GMCommand
; GammaImage
; GaussianBlurImage
; GaussianBlurImageChannel
; GenerateDifferentialNoise
; GenerateNoise
; GetBlobFileHandle
; GetBlobInfo
; GetBlobIsOpen
; GetBlobSize
; GetBlobStatus
; GetBlobStreamData
; GetBlobTemporary
; GetCacheView
; GetCacheViewArea
; GetCacheViewIndexes
; GetCacheViewPixels
; GetCacheViewRegion
; GetClientFilename
; GetClientName
; GetClientPath
; GetColorHistogram
; GetColorInfo
; GetColorInfoArray
; GetColorList
; GetColorTuple
; GetConfigureBlob
; GetDelegateCommand
; GetDelegateInfo
; GetDrawInfo
; GetElapsedTime
OSPrototype Prototype_GetExceptionInfo(*exception.ExceptionInfo)
; GetExecutionPath
; GetExecutionPathUsingName
; GetFirstImageInList
; GetGeometry
; GetImageAttribute
; GetImageBoundingBox
; GetImageChannelDepth
; GetImageChannelDifference
; GetImageChannelDistortion
; GetImageCharacteristics
; GetImageClipMask
; GetImageClippingPathAttribute
; GetImageDepth
; GetImageDistortion
; GetImageException
; GetImageFromList
; GetImageFromMagickRegistry
; GetImageGeometry
; GetImageIndexInList
; GetImageInfo
; GetImageInfoAttribute
; GetImageListLength
; GetImageMagick
; GetImagePixels
; GetImagePixelsEx
; GetImageProfile
; GetImageQuantizeError
; GetImageStatistics
; GetImageType
; GetImageVirtualPixelMethod
; GetIndexes
; GetLastImageInList
; GetLocaleExceptionMessage
; GetLocaleMessage
; GetLocaleMessageFromID
OSPrototype.i Prototype_GetMagickCopyright()
; GetMagickDimension
; GetMagickFileFormat
; GetMagickGeometry
; GetMagickInfo
; GetMagickInfoArray
; GetMagickRegistry
; GetMagickResource
; GetMagickResourceLimit
OSPrototype.i Prototype_GetMagickVersion(*version)
OSPrototype.i Prototype_GetMagickWebSite()
; GetModuleInfo
; GetMontageInfo
; GetNextImageInList
; GetNumberColors
; GetOnePixel
; GetOptimalKernelWidth
; GetOptimalKernelWidth1D
; GetOptimalKernelWidth2D
; GetPageGeometry
; GetPathComponent
; GetPixelCacheArea
; GetPixelCachePresent
; GetPixels
; GetPostscriptDelegateInfo
; GetPreviousImageInList
; GetQuantizeInfo
; GetSignatureInfo
; GetThreadViewDataSetAllocatedViews
; GetTimerInfo
; GetTimerResolution
; GetToken
; GetTypeInfo
; GetTypeInfoByFamily
; GetTypeList
; GetTypeMetrics
; GetUserTime
; GlobExpression
; GradientImage
; GrayscalePseudoClassImage
; HSLTransform
; HWBTransform
; HaldClutImage
; HighlightColor
; HighlightStyleToString
; HuffmanDecodeImage
; HuffmanEncode2Image
; HuffmanEncodeImage
; Hull
; IdentifyImageCommand
; IdentityAffine
; ImageListToArray
; ImageToBlob
; ImageToFile
; ImageToHBITMAP
; ImageToHuffman2DBlob
; ImageToJPEGBlob
; ImageTypeToString
; ImplodeImage
; ImportImageChannel
; ImportImageChannelsMasked
; ImportImageCommand
; ImportImagePixelArea
; ImportPixelAreaOptionsInit
; ImportViewPixelArea
; InitializeDifferenceImageOptions
; InitializeDifferenceStatistics
; InitializeMagicInfo
OSPrototype Prototype_InitializeMagick(path.p-ascii)
; InitializeMagickClientPathAndName
; InitializeMagickModules
; InitializeMagickRandomKernel
; InitializeMagickResources
; InitializeMagickSignalHandlers
; InitializePixelIteratorOptions
; InitializeSemaphore
; InsertImageInList
; InterlaceTypeToString
; InterpolateColor
; InterpolateViewColor
; InvokeDelegate
; InvokePostscriptDelegate
; IsAccessible
; IsAccessibleAndNotEmpty
; IsAccessibleNoLogging
; IsEventLogging
; IsGeometry
; IsGlob
; IsGrayImage
; IsImagesEqual
; IsMagickConflict
; IsMonochromeImage
; IsOpaqueImage
; IsPaletteImage
; IsSubimage
; IsTaintImage
; IsWindows95
; IsWriteable
; LZWEncode2Image
; LZWEncodeImage
; LevelImage
; LevelImageChannel
; LiberateMagickResource
; LiberateMemory
; LiberateSemaphoreInfo
; LiberateTemporaryFile
; ListColorInfo
; ListDelegateInfo
; ListFiles
; ListMagicInfo
; ListMagickInfo
; ListMagickResourceInfo
; ListModuleInfo
; ListModuleMap
; ListTypeInfo
; LoadImageText
; LoadImagesText
; LocaleCompare
; LocaleLower
; LocaleNCompare
; LocaleUpper
; LockSemaphoreInfo
; LogMagickEvent
; LogMagickEventList
; MSBOrderLong
; MSBOrderShort
; MagickAllocFunctions
; MagickArraySize
; MagickBitStreamInitializeRead
; MagickBitStreamInitializeWrite
; MagickBitStreamMSBRead
; MagickBitStreamMSBWrite
; MagickCloneMemory
; MagickCommand
; MagickCompositeImageUnderColor
; MagickConfirmAccess
; MagickConstrainColormapIndex
; MagickCreateDirectoryPath
; MagickError
; MagickFatalError
; MagickFindRawImageMinMax
; MagickFormatString
; MagickFormatStringList
; MagickFree
; MagickFreeAligned
; MagickGetBitRevTable
; MagickGetMMUPageSize
; MagickGetQuantumSamplesPerPixel
; MagickMalloc
; MagickMallocAligned
; MagickMallocAlignedArray
; MagickMallocArray
; MagickMallocCleared
; MagickMapAccessEntry
; MagickMapAddEntry
; MagickMapAllocateIterator
; MagickMapAllocateMap
; MagickMapClearMap
; MagickMapCloneMap
; MagickMapCopyBlob
; MagickMapCopyString
; MagickMapDeallocateBlob
; MagickMapDeallocateIterator
; MagickMapDeallocateMap
; MagickMapDeallocateString
; MagickMapDereferenceIterator
; MagickMapIterateNext
; MagickMapIteratePrevious
; MagickMapIterateToBack
; MagickMapIterateToFront
; MagickMapRemoveEntry
; MagickMonitor
; MagickMonitorFormatted
; MagickRandNewSeed
; MagickRandReentrant
; MagickRandomInteger
; MagickRandomReal
; MagickRealloc
; MagickReverseBits
; MagickSceneFileName
; MagickSetConfirmAccessHandler
; MagickSizeStrToInt64
; MagickSpawnVP
; MagickStripSpacesFromString
; MagickStrlCat
; MagickStrlCpy
; MagickStrlCpyTrunc
; MagickSwabArrayOfDouble
; MagickSwabArrayOfFloat
; MagickSwabArrayOfUInt16
; MagickSwabArrayOfUInt32
; MagickSwabDouble
; MagickSwabFloat
; MagickSwabUInt16
; MagickSwabUInt32
; MagickToMime
; MagickTsdGetSpecific
; MagickTsdKeyCreate
; MagickTsdKeyCreate2
; MagickTsdKeyDelete
; MagickTsdSetSpecific
; MagickWarning
; MagickWordStreamInitializeRead
; MagickWordStreamInitializeWrite
; MagickWordStreamLSBRead
; MagickWordStreamLSBWrite
; MagickWordStreamLSBWriteFlush
; MagnifyImage
; MapBlob
; MapImage
; MapImages
; MapModeToString
; MatteColor
; MatteFloodfillImage
; MedianFilterImage
; MetricTypeToString
; MinifyImage
; ModifyImage
; Modulate
; ModulateImage
; MogrifyImage
; MogrifyImageCommand
; MogrifyImages
; MontageImageCommand
; MontageImages
; MorphImages
; MosaicImages
; MotionBlurImage
; MultilineCensus
; NTElapsedTime
; NTErrorHandler
; NTGetExecutionPath
; NTGetLastError
; NTGetTypeList
; NTGhostscriptDLL
; NTGhostscriptDLLVectors
; NTGhostscriptEXE
; NTGhostscriptFonts
; NTGhostscriptLoadDLL
; NTGhostscriptUnLoadDLL
; NTInitializeExceptionHandlers
; NTIsMagickConflict
; NTKernelAPISupported
; NTRegistryKeyLookup
; NTResourceToBlob
; NTSystemComman
; NTUserTime
; NTWarningHandler
; NTclosedir
; NTdlclose
; NTdlerror
; NTdlexit
; NTdlinit
; NTdlopen
; NTdlsetsearchpath
; NTdlsym
; NTftruncate
; NTmmap
; NTmsync
; NTmunmap
; NTopendir
; NTreaddir
; NTseekdir
; NTtelldir
; NegateImage
; NewImageList
; NextImageProfile
; NoiseTypeToString
; NormalizeImage
; OilPaintImage
; OpaqueImage
; OpenBlob
; OpenCacheView
; OpenModule
; OpenModules
; OrderedDitherImage
; OrientationTypeToString
; PSDensityGeometry
; PSPageGeometry
; PackbitsEncode2Image
; PackbitsEncodeImage
; PanicDestroyMagick
; PersistCache
; PingBlob
; PingImage
; PixelIterateDualModify
; PixelIterateDualNew
; PixelIterateDualRead
; PixelIterateMonoModify
; PixelIterateMonoRead
; PixelIterateTripleModify
; PixelIterateTripleNew
; PlasmaImage
; PopImagePixels
; PrependImageToList
; ProfileImage
; PurgeTemporaryFiles
; PurgeTemporaryFilesAsyncSafe
; PushImagePixels
; QuantizeImage
; QuantizeImages
; QuantumOperatorImage
; QuantumOperatorImageMultivalue
; QuantumOperatorRegionImage
; QuantumOperatorToString
; QuantumSampleTypeToString
; QuantumTypeToString
; QueryColorDatabase
; QueryColorname
; RGBTransformImage
OSPrototype.i Prototype_RaiseImage(*image.GraphicsMagick_Image, *raise_info.RectangleInfo, raise_flag.l)
; RandomChannelThresholdImage
; ReacquireMemory
; ReadBlob
; ReadBlobByte
; ReadBlobLSBDouble
; ReadBlobLSBDoubles
; ReadBlobLSBFloat
; ReadBlobLSBFloats
; ReadBlobLSBLong
; ReadBlobLSBLongs
; ReadBlobLSBShort
; ReadBlobLSBShorts
; ReadBlobMSBDouble
; ReadBlobMSBDoubles
; ReadBlobMSBFloat
; ReadBlobMSBFloats
; ReadBlobMSBLong
; ReadBlobMSBLongs
; ReadBlobMSBShort
; ReadBlobMSBShorts
; ReadBlobString
; ReadBlobZC
OSPrototype.i Prototype_ReadImage(*image_info.GraphicsMagick_ImageInfo, *exception.ExceptionInfo)
; ReadInlineImage
; ReduceNoiseImage
; ReferenceBlob
; ReferenceImage
; RegisterMagickInfo
; RegisterStaticModules
; RemoveDefinitions
; RemoveFirstImageFromList
; RemoveLastImageFromList
; ReplaceImageColormap
; ReplaceImageInList
; ResetImagePage
; ResetTimer
; ResizeFilterToString
; ResizeImage
; ResolutionTypeToString
; ReverseImageList
OSPrototype.i Prototype_RollImage(*image.GraphicsMagick_Image, x_offset.l, y_offset.l, *exception.ExceptionInfo) 
; RotateImage
; SampleImage
; SaveImageText
; SaveImagesText
; ScaleImage
; SeekBlob
; SegmentImage
; SetBlobClosable
; SetBlobTemporary
; SetCacheView
; SetCacheViewPixels
; SetClientFilename
; SetClientName
; SetClientPath
; SetDelegateInfo
; SetErrorHandler
; SetExceptionInfo
; SetFatalErrorHandler
; SetGeometry
; SetImage
; SetImageAttribute
; SetImageChannelDepth
; SetImageClipMask
; SetImageColor
; SetImageColorRegion
; SetImageDepth
; SetImageEx
; SetImageInfo
; SetImageOpacity
; SetImagePixels
; SetImagePixelsEx
; SetImageProfile
; SetImageType
; SetImageVirtualPixelMethod
; SetLogEventMask
; SetLogFormat
; SetLogMethod
; SetMagickInfo
; SetMagickRegistry
; SetMagickResourceLimit
; SetMonitorHandler
; SetWarningHandler
; ShadeImage
; SharpenImage
; SharpenImageChannel
; ShaveImage
; ShearImage
; SignatureImage
; SolarizeImage
; SortColormapByIntensity
; SpliceImageIntoList
; SplitImageList
; SpreadImage
; SteganoImage
; StereoImage
; StorageTypeToString
; StretchTypeToString
; StringToArgv
; StringToChannelType
; StringToColorspaceType
; StringToCompositeOperator
; StringToCompressionType
; StringToDouble
; StringToEndianType
; StringToFilterTypes
; StringToGravityType
; StringToHighlightStyle
; StringToImageType
; StringToInterlaceType
; StringToList
; StringToMetricType
; StringToNoiseType
; StringToOrientationType
; StringToPreviewType
; StringToQuantumOperator
; StringToResolutionType
; StringToResourceType
; StringToVirtualPixelMethod
; Strip
; StripImage
; StyleTypeToString
; SubstituteString
; SwirlImage
; SyncCacheView
; SyncCacheViewPixels
; SyncImage
; SyncImagePixels
; SyncImagePixelsEx
; SyncNextImageInList
; SystemCommand
; TellBlob
; TextureImage
; ThresholdImage
; ThrowException
; ThrowLoggedException
; ThumbnailImage
; TimeImageCommand
; Tokenizer
; TransformColorspace
; TransformHSL
; TransformHWB
; TransformImage
; TransformRGBImage
; TransformSignature
; TranslateText
; TranslateTextEx
; TransparentImage
; UnlockSemaphoreInfo
; UnmapBlob
; UnregisterMagickInfo
; UnregisterStaticModules
; UnsharpMaskImage
; UnsharpMaskImageChannel
; UpdateSignature
; WaveImage
; WhiteThresholdImage
; WriteBlob
; WriteBlobByte
; WriteBlobFile
; WriteBlobLSBLong
; WriteBlobLSBShort
; WriteBlobMSBLong
; WriteBlobMSBShort
; WriteBlobString
OSPrototype.i Prototype_WriteImage(*imageInfo.GraphicsMagick_ImageInfo, *image.GraphicsMagick_Image)
; WriteImages
; WriteImagesFile
; ZoomImage
; _Gm_convert_fp16_to_fp32
; _Gm_convert_fp24_to_fp32
; _Gm_convert_fp32_to_fp16
; _Gm_convert_fp32_to_fp24
; _MagickError
; _MagickFatalError
; _MagickWarning



Global BorderImage.Prototype_BorderImage
Global ChopImage.Prototype_ChopImage
Global CloneImage.Prototype_CloneImage
Global CloneImageInfo.Prototype_CloneImageInfo
Global CropImage.Prototype_CropImage
Global DestroyImage.Prototype_DestroyImage
Global DestroyImageInfo.Prototype_DestroyImageInfo
Global DestroyMagick.Prototype_DestroyMagick
Global ExtentImage.Prototype_ExtentImage
Global FlipImage.Prototype_FlipImage
Global FlopImage.Prototype_FlopImage
Global FrameImage.Prototype_FrameImage
Global GetExceptionInfo.Prototype_GetExceptionInfo
Global InitializeMagick.Prototype_InitializeMagick
Global GetMagickVersion.Prototype_GetMagickVersion
Global GetMagickCopyright.Prototype_GetMagickCopyright
Global GetMagickWebSite.Prototype_GetMagickWebSite
Global RaiseImage.Prototype_RaiseImage
Global ReadImage.Prototype_ReadImage
Global RollImage.Prototype_RollImage
Global WriteImage.Prototype_WriteImage




Procedure.i GraphicsMagick_Open(Filename$="")
  
  Protected Help$
  
  
  If Len(Filename$)
    GraphicsMagick_Filename$ = Filename$
  EndIf
  
  Help$ = GetCurrentDirectory()
  
  SetCurrentDirectory(GetPathPart(GraphicsMagick_Filename$))
  
  GraphicsMagick = OpenLibrary(#PB_Any, GraphicsMagick_Filename$)
  
  If GraphicsMagick
    BorderImage = GetFunction(GraphicsMagick, "BorderImage")
    ChopImage = GetFunction(GraphicsMagick, "ChopImage")
    CloneImage = GetFunction(GraphicsMagick, "CloneImage")
    CloneImageInfo = GetFunction(GraphicsMagick, "CloneImageInfo")
    CropImage = GetFunction(GraphicsMagick, "CropImage")
    DestroyImage = GetFunction(GraphicsMagick, "DestroyImage")
    DestroyImageInfo = GetFunction(GraphicsMagick, "DestroyImageInfo")
    DestroyMagick = GetFunction(GraphicsMagick, "DestroyMagick")
    ExtentImage = GetFunction(GraphicsMagick, "ExtentImage")
    FlipImage = GetFunction(GraphicsMagick, "FlipImage")
    FlopImage = GetFunction(GraphicsMagick, "FlopImage")
    FrameImage = GetFunction(GraphicsMagick, "FrameImage")
    GetExceptionInfo = GetFunction(GraphicsMagick, "GetExceptionInfo")
    InitializeMagick = GetFunction(GraphicsMagick, "InitializeMagick")
    GetMagickVersion = GetFunction(GraphicsMagick, "GetMagickVersion")
    GetMagickCopyright = GetFunction(GraphicsMagick, "GetMagickCopyright")
    GetMagickWebSite = GetFunction(GraphicsMagick, "GetMagickWebSite")
    RaiseImage = GetFunction(GraphicsMagick, "RaiseImage")
    ReadImage = GetFunction(GraphicsMagick, "ReadImage")
    RollImage = GetFunction(GraphicsMagick, "RollImage")
    WriteImage = GetFunction(GraphicsMagick, "WriteImage")
  EndIf
  
  SetCurrentDirectory(Help$)
  
  ProcedureReturn GraphicsMagick
  
EndProcedure


Procedure GraphicsMagick_Close()
  If IsLibrary(GraphicsMagick)
    CloseLibrary(GraphicsMagick)
  EndIf
  GraphicsMagick = 0
EndProcedure


;-Demo
CompilerIf #PB_Compiler_IsMainFile
  
  Define Version.l, *String, exception.i, Parameters.i
  Define Text$, InFile$, OutFile$
  Define *imageInfo.GraphicsMagick_ImageInfo, *image3Info.GraphicsMagick_ImageInfo
  Define *image.GraphicsMagick_Image
  Define *image2.GraphicsMagick_Image
  Define *image3.GraphicsMagick_Image
  Define RectangleInf.RectangleInfo
  Define ExceptionInf.ExceptionInfo
  Define FrameInf.FrameInfo
  
  
  Parameters = CountProgramParameters()
  If Parameters <> 2
    Text$ = "You need an infile name and an outfilename as parameter" + #LF$
    Text$ + #LF$
    Text$ + "It converts the format of the file" + #LF$
    Text$ + #LF$
    Text$ + "example:" + #LF$
    Text$ + "prog.exe c:\tmp\test.jpg c:\tmp\test.png"
    MessageRequester("Help", Text$)
    End
  EndIf
  
  InFile$ = ProgramParameter(0)
  OutFile$ = ProgramParameter(1)
  
  If GraphicsMagick_Open("c:\Program Files (x86)\GraphicsMagick-1.3.23-Q8\CORE_RL_magick_.dll")
    
    *String = GetMagickVersion(@Version)
    Debug "Version: " + PeekS(*String, -1, #PB_Ascii)
    Debug "Version No: " + Hex(Version)
    Debug ""
    
    *String = GetMagickCopyright()
    Debug "Copyright: " + PeekS(*String, -1, #PB_Ascii)
    Debug ""
    
    *String = GetMagickWebSite()
    Debug "WebSite: " + PeekS(*String, -1, #PB_Ascii)
    Debug ""
    
    InitializeMagick(#Null$)
    *imageInfo = CloneImageInfo(#Null)
    
    GetExceptionInfo(@ExceptionInf)
    
    PokeS(@*imageInfo\filename[0], InFile$, -1, #PB_Ascii)
    
    *image = ReadImage(*imageInfo, @ExceptionInf)
    If *image
      
      Debug "Columns x Rows: " + Str(*image\columns) + "x" + Str(*image\rows)
      Debug "Filename: " + PeekS(@*image\magick_filename[0], -1, #PB_Ascii)
      
      PokeS(@*image\filename[0], OutFile$, -1, #PB_Ascii)
      
      RectangleInf\x = 10
      RectangleInf\y = 10
      RectangleInf\width = 100
      RectangleInf\height = 100
      *image2 = CropImage(*image, @RectangleInf, @ExceptionInf)
      If *image2
        PokeS(@*image2\filename[0], OutFile$ + "_crop.png", -1, #PB_Ascii)
        If WriteImage(*imageInfo, *image2)
          Debug "Crop Ok"
        EndIf
        
        RectangleInf\x = 0
        RectangleInf\y = 0
        RectangleInf\width = 20
        RectangleInf\height = 30
        *image3 = BorderImage(*image2, @RectangleInf, @ExceptionInf)
        If *image3
          PokeS(@*image3\filename[0], OutFile$ + "_crop_border.png", -1, #PB_Ascii)
          If WriteImage(*imageInfo, *image3)
            Debug "Border Ok"
          EndIf
          DestroyImage(*image3)
        EndIf
        
        RectangleInf\x = 50
        RectangleInf\y = 1
        RectangleInf\width = 150
        RectangleInf\height = 150
        *image3 = ChopImage(*image, @RectangleInf, @ExceptionInf)
        If *image3
          PokeS(@*image3\filename[0], OutFile$ + "_chop.png", -1, #PB_Ascii)
          If WriteImage(*imageInfo, *image3)
            Debug "Chop Ok"
          EndIf
          DestroyImage(*image3)
        EndIf
        
        RectangleInf\x = 1
        RectangleInf\y = 1
        RectangleInf\width = 15
        RectangleInf\height = 15
        *image3 = ExtentImage(*image2, @RectangleInf, @exception)
        If *image3
          PokeS(@*image3\filename[0], OutFile$ + "_extent.png", -1, #PB_Ascii)
          If WriteImage(*imageInfo, *image3)
            Debug "Extent Ok"
          EndIf
          DestroyImage(*image3)
        EndIf
        
        *image3 = FlipImage(*image, @ExceptionInf)
        If *image3
          PokeS(@*image3\filename[0], OutFile$ + "_flip.png", -1, #PB_Ascii)
          If WriteImage(*imageInfo, *image3)
            Debug "Flip Ok"
          EndIf
          DestroyImage(*image3)
        EndIf
        
        *image3 = FlopImage(*image, @ExceptionInf)
        If *image3
          PokeS(@*image3\filename[0], OutFile$ + "_flop.png", -1, #PB_Ascii)
          If WriteImage(*imageInfo, *image3)
            Debug "Flop Ok"
          EndIf
          DestroyImage(*image3)
        EndIf
        
        *image3 = RollImage(*image, 20, 40, @ExceptionInf)
        If *image3
          PokeS(@*image3\filename[0], OutFile$ + "_roll.png", -1, #PB_Ascii)
          If WriteImage(*imageInfo, *image3)
            Debug "Roll Ok"
          EndIf
          DestroyImage(*image3)
        EndIf
        
        FrameInf\height = *image\rows + 100
        FrameInf\width = *image\columns + 200
        FrameInf\inner_bevel = 10
        FrameInf\outer_bevel = 10
        FrameInf\x = 20
        FrameInf\Y = 20
        *image3 = FrameImage(*image, @FrameInf, @ExceptionInf)
        If *image3
          PokeS(@*image3\filename[0], OutFile$ + "_frame.png", -1, #PB_Ascii)
          If WriteImage(*imageInfo, *image3)
            Debug "Frame Ok"
          EndIf
          DestroyImage(*image3)
        Else
          Debug PeekS(ExceptionInf\description, -1, #PB_Ascii)
        EndIf
        
        
        *image3 = CloneImage(*image, 0, 0, #True, @ExceptionInf)
        If *image3
          RectangleInf\x = 0
          RectangleInf\y = 0
          RectangleInf\width = 20
          RectangleInf\height = 20
          If RaiseImage(*image3, @RectangleInf, 1)
            PokeS(@*image3\filename[0], OutFile$ + "_raise.png", -1, #PB_Ascii)
            If WriteImage(*imageInfo, *image3)
              Debug "Raise Ok"
            EndIf
          EndIf
          DestroyImage(*image3)
        Else
          Debug PeekS(ExceptionInf\description, -1, #PB_Ascii)
        EndIf
        
        DestroyImage(*image2)
      EndIf
      
      If WriteImage(*imageInfo, *image)
        Debug "Convert Ok"
      EndIf
      
      DestroyImage(*image)
    Else
      Debug "Exception: " + Str(exception)
    EndIf
    
    If *imageInfo
      DestroyImageInfo(*imageInfo)
    EndIf
    
    DestroyMagick()
    
    GraphicsMagick_Close()
  EndIf
  
CompilerEndIf
Compile it as convert.exe, than it does the same as the example on the programmer web page.
Only 8xx declarations left to implement :mrgreen:

Oh, at the moment:
only Quantum 8
only tested the 32 bit version GraphicsMagick-1.3.23-Q8-win32-dll.exe
with Win7 x64 and PB 5.41 x86

Feel free to extend it.

CropImage() added and tested.
BorderImage() added and tested.
ChopImage() added and ?
ExtentImage() added and ?
FlipImage() added and tested.
FlopImage() added and tested.
RollImage() added and tested.
FrameImage() added and ?
RaiseImage() added and tested.

Bernd
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Wrapper for the ImageMagick lib

Post by IdeasVacuum »

Only 8xx declarations left to implement
Huge amount of work already done Bernd 8)
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Wrapper for the ImageMagick lib

Post by Kwai chang caine »

I like when you have "A bit of time" INFRATEC :mrgreen:
Works well, on W7 32 bits pb 5.23, i obtain all the images Flip, rotate, Flop, ..
Thanks for sharing 8)
ImageThe happiness is a road...
Not a destination
Post Reply