imagemagick-0.0.4.2: bindings to imagemagick library

Safe HaskellNone
LanguageHaskell98

Graphics.ImageMagick.MagickWand.WandImage

Synopsis

Documentation

getImagePixelColor Source

Arguments

:: MonadResource m 
=> PMagickWand 
-> Int

pixel x coordinate

-> Int

pixel y coordinate

-> PPixelWand

return the colormap color in this wand

-> m () 

returns the color of the specified pixel into the pixelwand.

setImageCompression :: MonadResource m => PMagickWand -> CompressionType -> m () Source

Sets the image compression.

transparentPaintImage Source

Arguments

:: MonadResource m 
=> PMagickWand 
-> PPixelWand

change this color to specified opacity value withing the image

-> Double

the level of transarency: 1.0 fully opaque 0.0 fully transparent

-> Double

By default target must match a particular pixel color exactly. However, in many cases two colors may differ by a small amount. The fuzz member of image defines how much tolerance is acceptable to consider two colors as the same. For example, set fuzz to 10 and the color red at intensities of 100 and 102 respectively are now interpreted as the same color for the purposes of the floodfill.

-> Bool 
-> m () 

transparentPaintImage changes any pixel that matches color with the color defined by fill.

newImage Source

Arguments

:: MonadResource m 
=> PMagickWand 
-> Int

width

-> Int

height

-> PPixelWand

background color

-> m () 

newImage adds a blank image canvas of the specified size and background color to the wand.

drawImage :: MonadResource m => PMagickWand -> PDrawingWand -> m () Source

drawImage renders the drawing wand on the current image.

blurImage :: MonadResource m => PMagickWand -> Double -> Double -> m () Source

MagickBlurImage() blurs an image. We convolve the image with a gaussian operator of the given radius and standard deviation (sigma). For reasonable results, the radius should be larger than sigma. Use a radius of 0 and BlurImage() selects a suitable radius for you.

The format of the MagickBlurImage method is:

normalizeImage :: MonadResource m => PMagickWand -> m () Source

MagickNormalizeImage() enhances the contrast of a color image by adjusting the pixels color to span the entire range of colors available

You can also reduce the influence of a particular channel with a gamma value of 0.

shadowImage Source

Arguments

:: MonadResource m 
=> PMagickWand

the magick wand

-> Double

percentage transparency

-> Double

the standard deviation of the Gaussian, in pixels

-> Int

the shadow x-offset

-> Int

the shadow y-offset

-> m () 

Simulates an image shadow.

appendImages Source

Arguments

:: MonadResource m 
=> PMagickWand 
-> Bool

By default, images are stacked left-to-right. Set stack to MagickTrue to stack them top-to-bottom.

-> m (ReleaseKey, PMagickWand) 

MagickAppendImages() append the images in a wand from the current image onwards, creating a new wand with the single image result. This is affected by the gravity and background settings of the first image. Typically you would call either MagickResetIterator() or MagickSetFirstImage() before calling this function to ensure that all the images in the wand's image list will be appended together.

addNoiseImage Source

Arguments

:: MonadResource m 
=> PMagickWand 
-> NoiseType

The type of noise: Uniform, Gaussian, Multiplicative, Impulse, Laplacian, or Poisson.

-> m () 

MagickAddNoiseImage() adds random noise to the image.

writeImage :: MonadResource m => PMagickWand -> Maybe Text -> m () Source

writeImage() writes an image to the specified filename. If the filename parameter is Nothing, the image is written to the filename set by MagickReadImage or MagickSetImageFilename().

setVirtualPixelMethod :: MonadResource m => PMagickWand -> VirtualPixelMethod -> m VirtualPixelMethod Source

sets the image virtual pixel method. the image virtual pixel method : UndefinedVirtualPixelMethod, ConstantVirtualPixelMethod, EdgeVirtualPixelMethod, MirrorVirtualPixelMethod, or TileVirtualPixelMethod.

trimImage :: MonadResource m => PMagickWand -> Double -> m () Source

Remove edges that are the background color from the image.

resetImagePage :: MonadResource m => PMagickWand -> Maybe Text -> m () Source

Resets the Wand page canvas and position.

distortImage Source

Arguments

:: MonadResource m 
=> PMagickWand 
-> DistortImageMethod

the method of image distortion

-> [Double]

the arguments for this distortion method

-> Bool

attempt to resize destination to fit distorted source

-> m () 

Resets the Wand page canvas and position.

shadeImage Source

Arguments

:: MonadResource m 
=> PMagickWand 
-> Bool

a value other than zero shades the intensity of each pixel

-> Double

azimuth of the light source direction

-> Double

evelation of the light source direction

-> m () 

Sshines a distant light on an image to create a three-dimensional effect. You control the positioning of the light with azimuth and elevation; azimuth is measured in degrees off the x axis and elevation is measured in pixels above the Z axis.

colorizeImage :: MonadResource m => PMagickWand -> PPixelWand -> PPixelWand -> m () Source

Resets the Wand page canvas and position.

fxImage :: MonadResource m => PMagickWand -> Text -> m (ReleaseKey, Ptr MagickWand) Source

Evaluate expression for each pixel in the image.

fxImageChannel :: MonadResource m => PMagickWand -> ChannelType -> Text -> m (ReleaseKey, Ptr MagickWand) Source

Evaluate expression for each pixel in the image.

sigmoidalContrastImage :: MonadResource m => PMagickWand -> Bool -> Double -> Double -> m () Source

Adjusts the contrast of an image with a non-linear sigmoidal contrast algorithm. Increase the contrast of the image using a sigmoidal transfer function without saturating highlights or shadows. Contrast indicates how much to increase the contrast (0 is none; 3 is typical; 20 is pushing it); mid-point indicates where midtones fall in the resultant image (0 is white; 50 is middle-gray; 100 is black). Set sharpen to True to increase the image contrast otherwise the contrast is reduced.

evaluateImage Source

Arguments

:: MonadResource m 
=> PMagickWand 
-> MagickEvaluateOperator

a channel operator

-> CDouble

value

-> m () 

Applies an arithmetic, relational, or logical expression to an image. Use these operators to lighten or darken an image, to increase or decrease contrast in an image, or to produce the "negative" of an image.

evaluateImageChannel Source

Arguments

:: MonadResource m 
=> PMagickWand 
-> ChannelType

the channel(s)

-> MagickEvaluateOperator

a channel operator

-> CDouble

value

-> m () 

evaluateImages Source

Arguments

:: MonadResource m 
=> PMagickWand 
-> MagickEvaluateOperator

a channel operator

-> m () 

rollImage :: MonadResource m => PMagickWand -> Double -> Double -> m () Source

Offsets an image as defined by x and y.

annotateImage Source

Arguments

:: MonadResource m 
=> PMagickWand 
-> PDrawingWand

the draw wand

-> Double

x ordinate to left of text

-> Double

y ordinate to text baseline

-> Double

rotate text relative to this angle

-> Text

text to draw

-> m () 

Annotates an image with text.

mergeImageLayers :: MonadResource m => PMagickWand -> ImageLayerMethod -> m (ReleaseKey, PMagickWand) Source

Composes all the image layers from the current given image onward to produce a single image of the merged layers. The inital canvas's size depends on the given ImageLayerMethod, and is initialized using the first images background color. The images are then compositied onto that image in sequence using the given composition that has been assigned to each individual image.

tintImage Source

Arguments

:: MonadResource m 
=> PMagickWand 
-> PPixelWand

tint pixel

-> PPixelWand

opacity pixel

-> m () 

Applies a color vector to each pixel in the image. The length of the vector is 0 for black and white and at its maximum for the midtones. The vector weighting function is f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).

The format of the MagickTintImage method is:

gaussianBlurImage :: MonadResource m => PMagickWand -> Double -> Double -> m () Source

MagickGaussianBlurImage() blurs an image. We convolve the image with a Gaussian operator of the given radius and standard deviation (sigma). For reasonable results, the radius should be larger than sigma. Use a radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.

cropImage Source

Arguments

:: MonadResource m 
=> PMagickWand 
-> Int

the region width

-> Int

the region height

-> Int

the region x-offset

-> Int

the region y-offset

-> m () 

Extracts a region of the image.

shearImage Source

Arguments

:: MonadResource m 
=> PMagickWand 
-> PPixelWand

the background pixel wand

-> Double

the number of degrees to shear the image

-> Double

the number of degrees to shear the image

-> m () 

Slides one edge of an image along the X or Y axis, creating a parallelogram. An X direction shear slides an edge along the X axis, while a Y direction shear slides an edge along the Y axis. The amount of the shear is controlled by a shear angle. For X direction shears, x_shear is measured relative to the Y axis, and similarly, for Y direction shears y_shear is measured relative to the X axis. Empty triangles left over from shearing the image are filled with the background color.

scaleImage Source

Arguments

:: MonadResource m 
=> PMagickWand 
-> Int

the number of degrees to shear the image

-> Int

the number of degrees to shear the image

-> m () 

Scales the size of an image to the given dimensions.

sparseColorImage :: MonadResource m => PMagickWand -> ChannelType -> SparseColorMethod -> Vector Double -> m () Source

MagickSparseColorImage(), given a set of coordinates, interpolates the colors found at those coordinates, across the whole image, using various methods.

The format of the MagickSparseColorImage method is: ArcSparseColorion will always ignore source image offset, and always bestfit the destination image with the top left corner offset relative to the polar mapping center.

Bilinear has no simple inverse mapping so will not allow bestfit style of image sparseion.

Affine, Perspective, and Bilinear, will do least squares fitting of the distrotion when more than the minimum number of control point pairs are provided.

Perspective, and Bilinear, will fall back to a Affine sparseion when less than 4 control point pairs are provided. While Affine sparseions will let you use any number of control point pairs, that is Zero pairs is a No-Op (viewport only) distrotion, one pair is a translation and two pairs of control points will do a scale-rotate-translate, without any shearing.

functionImage :: MonadResource m => PMagickWand -> MagickFunction -> Vector Double -> m () Source

MagickFunctionImage() applys an arithmetic, relational, or logical expression to an image. Use these operators to lighten or darken an image, to increase or decrease contrast in an image, or to produce the "negative" of an image.

coalesceImages :: MonadResource m => PMagickWand -> m (ReleaseKey, PMagickWand) Source

MagickCoalesceImages() composites a set of images while respecting any page offsets and disposal methods. GIF, MIFF, and MNG animation sequences typically start with an image background and each subsequent image varies in size and offset. MagickCoalesceImages() returns a new sequence where each image in the sequence is the same size as the first and composited with the next image in the sequence.

getNumberImages :: MonadResource m => PMagickWand -> m Int Source

returns the number of images associated with a magick wand.

getImage :: MonadResource m => PMagickWand -> m (ReleaseKey, PMagickWand) Source

Gets the image at the current image index.

compareImageLayers :: MonadResource m => PMagickWand -> ImageLayerMethod -> m (ReleaseKey, PMagickWand) Source

Compares each image with the next in a sequence and returns the maximum bounding region of any pixel differences it discovers.

getImageAlphaChannel :: MonadResource m => PMagickWand -> m Bool Source

Returns False if the image alpha channel is not activated. That is, the image is RGB rather than RGBA or CMYK rather than CMYKA.

getImageBlob :: MonadResource m => PMagickWand -> m ByteString Source

MagickGetImageBlob() implements direct to memory image formats. It returns the image as a blob (a formatted "file" in memory) and its length, starting from the current position in the image sequence. Use setImageFormat to set the format to write to the blob (GIF, JPEG, PNG, etc.). ImageMagick blob is automatically freed in this function, returned bytestring is on haskell heap.

getImagesBlob :: MonadResource m => PMagickWand -> m ByteString Source

MagickGetImageBlob() implements direct to memory image formats. It returns the image sequence as a blob and its length. The format of the image determines the format of the returned blob (GIF, JPEG, PNG, etc.). To return a different image format, use MagickSetImageFormat().

Note, some image formats do not permit multiple images to the same image stream (e.g. JPEG). in this instance, just the first image of the sequence is returned as a blob.- Returns the image [sequence] as a blob and the total length

getImageDelay :: MonadResource m => PMagickWand -> m Int Source

Gets the image delay.

getImageDepth :: MonadResource m => PMagickWand -> m Int Source

Gets the image depth.

getImageFormat :: MonadResource m => PMagickWand -> m Text Source

Returns the format of a particular image in a sequence.

getImageSignature :: MonadResource m => PMagickWand -> m ByteString Source

Generates an SHA-256 message digest for the image pixel stream

optimizeImageLayers :: MonadResource m => PMagickWand -> m (ReleaseKey, PMagickWand) Source

MagickOptimizeImageLayers() compares each image the GIF disposed forms of the previous image in the sequence. From this it attempts to select the smallest cropped image to replace each frame, while preserving the results of the animation.

optimizeImageTransparency :: MonadResource m => PMagickWand -> m () Source

OptimizeImageTransparency() takes a frame optimized GIF animation, and | compares the overlayed pixels against the disposal image resulting from all | the previous frames in the animation. Any pixel that does not change the | disposal image (and thus does not effect the outcome of an overlay) is made | transparent. | | WARNING: This modifies the current images directly, rather than generate | a new image sequence.

readImage :: MonadResource m => Ptr MagickWand -> Text -> m () Source

Reads an image or image sequence. The images are inserted at the current image pointer position

readImageBlob :: MonadResource m => PMagickWand -> ByteString -> m () Source

Reads an image or image sequence from a blob

setImageDelay :: MonadResource m => PMagickWand -> Int -> m () Source

Sets the image delay.

setImageDepth :: MonadResource m => PMagickWand -> Int -> m () Source

Sets the image depth.

setImageType :: MonadResource m => PMagickWand -> ImageType -> m () Source

Sets image Type

stripImage :: MonadResource m => PMagickWand -> m () Source

Strips an image of all profiles and comments.

getImageScene :: MonadResource m => PMagickWand -> m Int Source

Gets the image scene

setImage :: MonadResource m => PMagickWand -> PMagickWand -> m () Source

Replaces the last image returned by setImageIndex and iteration methods with the images from the specified wand.

removeImage :: MonadResource m => PMagickWand -> m () Source

MagickRemoveImage() removes an image from the image list.

importImagePixels Source

Arguments

:: (MonadResource m, Pixel a) 
=> PMagickWand 
-> Int

x

-> Int

y

-> Int

columns

-> Int

rows TODO migrate to typesafe parameter

-> Text

map

-> [a]

imported pixels

-> m () 

Accepts pixel data. The pixel data can be in any Pixels format in the order specified by map.

exportImagePixels Source

Arguments

:: (MonadResource m, Pixel a) 
=> PMagickWand 
-> Int

x

-> Int

y

-> Int

columns

-> Int

rows TODO migrate to typesafe parameter

-> Text

map

-> m [a] 

Extracts pixel data from an image and returns it to you. The data is returned as Pixels in the order specified by cmap.

rotateImage :: MonadResource m => PMagickWand -> PPixelWand -> Double -> m () Source

Rotates an image the specified number of degrees. Empty triangles left over from rotating the image are filled with the background color.