Method: DynamicImage::ImageReader.magic_bytes

Defined in:
lib/dynamic_image/image_reader.rb

.magic_bytesObject



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/dynamic_image/image_reader.rb', line 6

def magic_bytes
  @magic_bytes ||= [
    "\x47\x49\x46\x38\x37\x61",         # GIF
    "\x47\x49\x46\x38\x39\x61",
    "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a", # PNG
    "\xff\xd8",                         # JPEG
    "\x49\x49\x2a\x00",                 # TIFF
    "\x4d\x4d\x00\x2a",
    "\x42\x4d"                          # BMP
  ].map { |s| s.dup.force_encoding("binary") }
end