Class: PDF::Writer::Graphics::ImageInfo

### Home Classes Methods

### In Files

- lib/pdf/writer/graphics/imageinfo.rb

### Parent

Object

### Namespace

- MODULE PDF::Writer::Graphics::ImageInfo::Formats
- MODULE PDF::Writer::Graphics::ImageInfo::Type

### Methods

- ::formats
- ::new
- ::type_list

### Files

- ChangeLog

### Class/Module Index

Quicksearch

- PDF
- PDF::Charts
- PDF::Charts::StdDev
- PDF::Charts::StdDev::Label
- PDF::Charts::StdDev::Marker
- PDF::Charts::StdDev::Scale
- PDF::Math
- PDF::QuickRef
- PDF::SimpleTable
- PDF::SimpleTable::Column
- PDF::SimpleTable::Column::Heading
- PDF::TechBook
- PDF::TechBook::TagTocDots
- PDF::TechBook::TagXref
- PDF::Writer
- PDF::Writer::ARC4
- PDF::Writer::Complex
- PDF::Writer::External
- PDF::Writer::FontMetrics
- PDF::Writer::Graphics
- PDF::Writer::Graphics::ImageInfo
- PDF::Writer::Graphics::ImageInfo::Formats
- PDF::Writer::Graphics::ImageInfo::Type
- PDF::Writer::Lang
- PDF::Writer::Lang::EN
- PDF::Writer::OHash
- PDF::Writer::Object
- PDF::Writer::Object::Action
- PDF::Writer::Object::Annotation
- PDF::Writer::Object::Catalog
- PDF::Writer::Object::Contents
- PDF::Writer::Object::Destination
- PDF::Writer::Object::Encryption
- PDF::Writer::Object::Font
- PDF::Writer::Object::FontDescriptor
- PDF::Writer::Object::FontEncoding
- PDF::Writer::Object::Info
- PDF::Writer::Object::Outline
- PDF::Writer::Object::Outlines
- PDF::Writer::Object::Pages
- PDF::Writer::Object::Procset
- PDF::Writer::Object::ViewerPreferences
- PDF::Writer::OffsetReader
- PDF::Writer::PolygonPoint
- PDF::Writer::State
- PDF::Writer::StateStack
- PDF::Writer::StrokeStyle

No matching classes.

# PDF::Writer::Graphics::ImageInfo

This is based on ImageSize, by Keisuke Minami <keisuke@rccn.com>. It can be found at www.rubycgi.org/tools/index.en.htm

This has been integrated into PDF::Writer because as yet there has been no response to emails asking for my extensions to be integrated and a RubyGem package to be made available.

### Constants

JPEG_APP_BLOCKS
JPEG_SOF_BLOCKS
Type
XBM_DIMENSIONS_RE
XPM_DIMENSIONS_RE

### Attributes

bits[R]
channels[R]
format[R]
get_height[R]
get_type[R]
get_width[R]
height[R]
info[R]
width[R]

### Public Class Methods

formats() click to toggle source

    # File lib/pdf/writer/graphics/imageinfo.rb, line 44
    def formats
      Formats.constants
    end

Also aliased as: type_list
new(data, format = nil) click to toggle source

Receive image & make size. argument is image String or IO

    # File lib/pdf/writer/graphics/imageinfo.rb, line 54
    def initialize(data, format = nil)
      @data   = data.dup rescue data
      @info   = {}

      if @data.kind_of?(IO)
        @top = @data.read(128)
        @data.seek(0, 0)
          # Define Singleton-method definition to IO (byte, offset)
        def @data.read_o(length = 1, offset = nil)
          self.seek(offset, 0) if offset
          ret = self.read(length)
          raise "cannot read!!" unless ret
          ret
        end
      elsif @data.is_a?(String)
        @top = @data[0, 128]
          # Define Singleton-method definition to String (byte, offset)
        @data.extend(PDF::Writer::OffsetReader)
      else
        raise "argument class error!! #{data.type}"
      end

      if format.nil?
        @format = discover_format
      else
        match = false
        Formats.constants.each { |t| match = true if format == t }
        raise("format is failed. #{format}\n") unless match
        @format = format
      end

      __send__("measure_#@format".intern) unless @format == Formats::OTHER

      @data = data.dup
    end

type_list() click to toggle source
Alias for: formats

[Validate]

Generated with the Darkfish Rdoc Generator 2.