Method: JPEG::Decoder#initialize

Defined in:
ext/jpeg/jpeg.c

#initialize(opts) ⇒ Object

initialize decoder object

Parameters:

  • opts (Hash)

    options to initialize object

Options Hash (opts):

  • :pixel_format (Symbol)

    specifies the format of the output image. possible values are: YUV422 YUYV RGB565 RGB RGB24 BGR BGR24 YUV444 YCbCr RGBX RGB32 BGRX BGR32 GRAYSCALE

  • :output_gamma (Float)
  • :fancy_upsampling (Boolean)
  • :do_smoothing (Boolean)
  • :dither (Array)

    specifies dithering parameters. A 3-elements array. specify the dither type as a string for the 1st element, whether to use 2-pass quantize for the 2nd element as a boolean, and the number of colors used for the 3rd element as an integer from 16 to 256.

  • :without_meta (Boolean)

    specifies whether or not to include meta information in the output data. If true, no meta-information is output.

  • :expand_colormap (Boolean)

    specifies whether to expand the color map. If dither is specified, the output will be a color number of 1 byte per pixel, but if this option is set to true, the output will be expanded to color information.

  • :scale (Ratioanl)
  • :dct_method (Symbol)

    specifies how decoding is handled. possible values are: FASTEST ISLOW IFAST FLOAT

  • :with_exif_tags (Boolean)

    specifies whether to include Exif tag information in the output data. set this option to true to parse the Exif tag information and include it in the meta information output.

  • :with_exif (Boolean)

    alias to :with_exif_tags option.



2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
# File 'ext/jpeg/jpeg.c', line 2001

static VALUE
rb_decoder_initialize( int argc, VALUE *argv, VALUE self)
{
  jpeg_decode_t* ptr;
  VALUE exc;
  VALUE opt;

  /*
   * initialize
   */
  TypedData_Get_Struct(self, jpeg_decode_t, &jpeg_decoder_data_type, ptr);

  /*
   * parse arguments
   */
  rb_scan_args( argc, argv, "0:", &opt);

  /*
   * set context
   */ 
  exc = set_decoder_context(ptr, opt);

  /*
   * post process
   */
  if (RTEST(exc)) rb_exc_raise(exc);

  return Qtrue;
}