Image Class Documentation
classImage : ElementNamespace:Datalogics::PDFL
- Inherits from:
Element
Detailed Description
An image resource can either be an image XObject or inline image found in a page's content stream.
An Image Xobject is stored separately from the graphics content stream in a PDF, and so can be used multiple times in the document, even across pages. The image is described in the /Xobject entry in the resources dictionary on the PDF page.
Image size and resoultion: For images that are imported from raster image files, the design width and height are stored in the Image object's Matrix, in the A (width) and D (depth) Matrix members, when the image is imported. These are stored in PDF units.
To derive the effective resolution of an image imported from a raster image file:
Horizontal resolution: divide the Image Width by the Image's Matrix A member and multiply by 72 to scale to DPI (dots per inch).
Vertical resolution: divide the Image Height by the Image's Matrix D member and multiply by 72 to scale to DPI (dots per inch).
Referenced by
Constructor & Destructor Documentation
Image
Image(CDotNetStreamFilefile)Parameters
file: CDotNetStreamFile
Image
Image(CDotNetStreamFilefile, Documentdocument)Parameters
file: CDotNetStreamFiledocument: Document
Image
Image(Imagerhs, InternalConstructsignifier)Parameters
rhs: Imagesignifier: InternalConstruct
Image
Image(stringfileName)Parameters
fileName: stringthe filename of the image file.
Create a new Image from an existing physical file. This file can be a bitmap, gif, jpeg, png, or a tiff file. An exception will be thrown if the image file is not any of the above.
NOTICE on tiff files: If the tiff file is multi-paged, then the first "page" only of the file will be converted to an Image. See ImageCollection to convert each page in a multi-page tiff file to an Image.
Image
Image(stringfileName, Documentdocument)Parameters
fileName: stringthe filename of the image file.
document: Documentthe document in which the image is intended to be used.
Create a new Image from an existing physical file. This file can be a bitmap, gif, jpeg, png, or a tiff file. An exception will be thrown if the image file is not any of the above.
Specifying the document optimizes data usage for this image within that document.
NOTICE on tiff files: If the tiff file is multi-paged, then the first "page" only of the file will be converted to an Image. See ImageCollection to convert each page in a multi-page tiff file to an Image.
Image
Image(System.IO.Streamstream)Parameters
stream: System.IO.StreamThe Stream from which to read the Image.
Create an Image from a Stream.
This allows an image to be read from a Stream object. The Stream must be seekable. Suitable examples are FileStream and MemoryStream. The Stream must contain image data in one of the supported file formats: TIFF, JPEG, BMP, PNG, or GIF.
NOTICE on tiff files: If the tiff file is multi-paged, then the first "page" only of the file will be converted to an Image. See ImageCollection to convert each page in a multi-page tiff file to an Image.
Image
Image(System.IO.Streamstream, Documentdocument)Parameters
stream: System.IO.StreamThe Stream from which to read the Image.
document: DocumentThe Document in which the Image is intended to be used.
Create an Image from a Stream.
This allows an image to be read from a Stream object. The Stream must be seekable. Suitable examples are FileStream and MemoryStream. The Stream must contain image data in one of the supported file formats: TIFF, JPEG, BMP, PNG, or GIF.
NOTICE on tiff files: If the tiff file is multi-paged, then the first "page" only of the file will be converted to an Image. See ImageCollection to convert each page in a multi-page tiff file to an Image.
Specifying the document optimizes data usage for this image within that document.
Image
Image(StreamFilesf, boolignore)Parameters
sf: StreamFileignore: bool
Image
Image(StreamFilesf, Documentdocument, boolignore)Parameters
sf: StreamFiledocument: Documentignore: bool
Property Documentation
Bitmap
System.Drawing.BitmapBitmap[get]Return this PDF image as a System.Drawing.Bitmap.
Images in Gray or RGB color spaces are returned without conversion, while images in other spaces are first converted to RGB.
BitsPerComponent
intBitsPerComponent[get]BoundingBox
RectBoundingBox[get]Clip
ClipClip[get, set]ColorSpace
ColorSpaceColorSpace[get]Compression
CompressionCodeCompression[get, set]Data
System.Byte[]Data[get]DidWarningsOccurDuringImport
boolDidWarningsOccurDuringImport[get]GraphicState
GraphicStateGraphicState[get, set]Height
intHeight[get]Intent
stringIntent[get, set]IsImageMask
boolIsImageMask[get]LargeData
System.Collections.Generic.IList< ImageData >LargeData[get]Matrix
MatrixMatrix[get, set]NumberComponents
intNumberComponents[get]SoftMask
ImageSoftMask[get, set]Stream
PDFStreamStream[get]Width
intWidth[get]Member Function Documentation
ChangeResolution
ImageChangeResolution(intdpi)Parameters
dpi: intthe new resolution
Returns:
newimage - the original image modified to the new resolution.Create a new image from an existing one modifying the resolution (dots per inch)
Clone
new ImageClone()Returns:
The copied image.Makes a copy of the image.
Make a copy of an image to obtain a new image that has a distinct set of attributes.
Clone
new ImageClone(ElementCloneFlagscloneFlags)Parameters
cloneFlags: ElementCloneFlagsFlags that modify the cloning operation.
Returns:
The copied image.Makes a copy of the image.
Make a copy of an image to obtain a new image that has a distinct set of attributes.
ColorConvert
ImageColorConvert(Documentdocument, ColorProfileprof, RenderIntentintent, boolembed)Parameters
document: DocumentThe document the element belongs to.
prof: ColorProfileThe ICC ColorProfile to be applied.
intent: RenderIntentThe ICC Rendering Intent for the ColorProfile
embed: boolIf true, embed the color space and make the object calibrated. If it is false and the target profile is CMYK, RGB, or Gray, the colors space of the resulting object, after conversion, will be DeviceCMYK, DeviceRGB, or DeviceGray, respectively.
Returns:
A new Image with the applied ICC ColorProfile.Applies the specified ICC ColorProfile to the Image
ConstructorRetrieve
static new static ImageConstructorRetrieve(System.IntPtrignored)Parameters
ignored: System.IntPtr
Returns:
new static ImageDispose
voidDispose()Returns:
voidDisposeChildren
voidDisposeChildren()Returns:
voidInternalGetData
voidInternalGetData(byte[]buffer, uintbufferSize, uintstride)Parameters
buffer: byte[]the buffer into which the image data is copied
bufferSize: uintthe size of the buffer in bytes
stride: uintthe width of each row of pixels, of 0 if same as width of image.
Returns:
voidRetrieve the image data into the specified buffer.
Rotate
new voidRotate(doubleangle)Parameters
angle: double
Returns:
new voidRotate an image on (angle) degree using the matrix [cos(a), sin(a), -sin(a), cos(a), 0, 0].
For images, this rotate is done without regard to the primary scaling of the original image
SKGetData
voidSKGetData(byte[]buffer, uintbufferSize, boolisBGR)Parameters
buffer: byte[]bufferSize: uintisBGR: bool
Returns:
voidRetrieve the image data into the specified buffer.
Save
voidSave(stringimagefilename, ImageTypeimageType)Parameters
imagefilename: stringThe physical image file which will be created.
imageType: ImageTypeThe IMAGETYPE used for saving the image.
Returns:
voidSave an image into a particular file format with default parameters for saving.
Save
voidSave(stringimagefilename, ImageTypeimageType, ImageSaveParamssaveparams)Parameters
imagefilename: stringThe physical image file which will be created.
imageType: ImageTypeThe ImageType used for saving the image.
saveparams: ImageSaveParamsThe ImageSaveParams for saving the image.
Returns:
voidSave an image into a particular file format with the given parameters for saving.
Scale
voidScale(doublesx, doublesy)Parameters
sx: doublesy: double
Returns:
voidScale an element by (sx,sy) units using the matrix [ sx 0 0 sy 0 0 ].
Translate
new voidTranslate(doubletx, doublety)Parameters
tx: doublety: double
Returns:
new voidTranslate an image by (tx,ty) units using the matrix [ 1 0 0 1 tx ty ].
For images, this translation is done without regard to the scaling and rotation of the original image.
To ensure that this translation can be done, do the translation before any further rotation or scaling.
internalGetColorSpaceHival
uintinternalGetColorSpaceHival()Returns:
uintinternalGetColorSpaceTable
System.Byte[]internalGetColorSpaceTable()Returns:
System.Byte[]internalGetNumColorSpaceComps
uintinternalGetNumColorSpaceComps()Returns:
uint