class HexaPDF:: Type:: Image
Parent | HexaPDF::Stream |
---|
Represents an image XObject of a PDF document.
See: PDF2.0 s8.8
Field Definitions
Name | Type/Allowed Values | Required | Default Value |
---|---|---|---|
Length | Integer | false | nil |
Filter | Symbol or HexaPDF::PDFArray or Array | false | nil |
DecodeParms | HexaPDF::Dictionary or HexaPDF::PDFArray or Hash or Array | false | nil |
F | HexaPDF::Type::FileSpecification or Hash or String | false | nil |
FFilter | Symbol or HexaPDF::PDFArray or Array | false | nil |
FDecodeParms | HexaPDF::Dictionary or HexaPDF::PDFArray or Hash or Array | false | nil |
DL | Integer | false | nil |
Type | Symbol | false | :XObject |
Subtype | Symbol | true | :Image |
Width | Integer | true | nil |
Height | Integer | true | nil |
ColorSpace | Symbol or HexaPDF::PDFArray or Array | false | nil |
BitsPerComponent | Integer | false | nil |
Intent | Symbol One of: :AbsoluteColorimetric, :RelativeColorimetric, :Saturation, :Perceptual | false | nil |
ImageMask | TrueClass or FalseClass | false | false |
Mask | HexaPDF::Stream or HexaPDF::PDFArray or Hash or Array | false | nil |
Decode | HexaPDF::PDFArray or Array | false | nil |
Interpolate | TrueClass or FalseClass | false | false |
Alternates | HexaPDF::PDFArray or Array | false | nil |
SMask | HexaPDF::Stream or Hash | false | nil |
SMaskInData | Integer One of: 0, 1, 2 | false | nil |
Name | Symbol | false | nil |
StructParent | Integer | false | nil |
ID | HexaPDF::DictionaryFields::PDFByteString or String | false | nil |
OPI | HexaPDF::Dictionary or Hash | false | nil |
Metadata | HexaPDF::Stream or Hash | false | nil |
OC | HexaPDF::Dictionary or Hash | false | nil |
AF | HexaPDF::PDFArray or Array | false | nil |
Measure | HexaPDF::Dictionary or Hash | false | nil |
PtData | HexaPDF::Dictionary or Hash | false | nil |
Constants
- Info¶
The structure that is returned by the
Image#info
method.
Attributes
Returns the source path that was used when creating the image object.
This value is only set when the image object was created by using the image loading facility and not when the image is part of a loaded PDF file.
Public Instance Methods
Returns the height of the image.
Returns an Info
structure with information about the image.
Available accessors:
- type
-
The type of the image. Either :jpeg, :jp2, :jbig2, :ccitt or :png.
- width
-
The width of the image.
- height
-
The height of the image.
- color_space
-
The color space the image uses. Either :rgb, :cmyk, :gray or :other.
- indexed
-
Whether the image uses an indexed color space or not.
- components
-
The number of color components of the color space, or -1 if the number couldn’t be determined.
- bits_per_component
-
The number of bits per color component.
- writable
-
Whether the image can be written by
HexaPDF
. - extension
-
The file extension that would be used when writing the file. Either jpg, jpx or png. Only meaningful when writable is true.
Returns the width of the image.
Saves this image XObject to the file with the given name and appends the correct extension (if the name already contains this extension, the name is used as is), or the given IO object.
Raises an error if the image format is not supported.
The output format and extension depends on the image type as returned by the info
method:
- :jpeg
-
Saved as a JPEG file with the extension ‘.jpg’
- :jp2
-
Saved as a JPEG2000 file with the extension ‘.jpx’
- :png
-
Saved as a PNG file with the extension ‘.png’