mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 02:06:18 +03:00
If SGI image is RGB mode, then apply image/rgb mimetype
This commit is contained in:
parent
97ae0c42b1
commit
42e2bed4a6
|
@ -12,6 +12,7 @@ class TestFileSgi(PillowTestCase):
|
||||||
|
|
||||||
im = Image.open(test_file)
|
im = Image.open(test_file)
|
||||||
self.assert_image_equal(im, hopper())
|
self.assert_image_equal(im, hopper())
|
||||||
|
self.assertEqual(im.get_format_mimetype(), 'image/rgb')
|
||||||
|
|
||||||
def test_rgb16(self):
|
def test_rgb16(self):
|
||||||
test_file = "Tests/images/hopper16.rgb"
|
test_file = "Tests/images/hopper16.rgb"
|
||||||
|
@ -26,6 +27,7 @@ class TestFileSgi(PillowTestCase):
|
||||||
|
|
||||||
im = Image.open(test_file)
|
im = Image.open(test_file)
|
||||||
self.assert_image_similar(im, hopper('L'), 2)
|
self.assert_image_similar(im, hopper('L'), 2)
|
||||||
|
self.assertEqual(im.get_format_mimetype(), 'image/sgi')
|
||||||
|
|
||||||
def test_rgba(self):
|
def test_rgba(self):
|
||||||
# Created with ImageMagick:
|
# Created with ImageMagick:
|
||||||
|
@ -35,6 +37,7 @@ class TestFileSgi(PillowTestCase):
|
||||||
im = Image.open(test_file)
|
im = Image.open(test_file)
|
||||||
target = Image.open('Tests/images/transparent.png')
|
target = Image.open('Tests/images/transparent.png')
|
||||||
self.assert_image_equal(im, target)
|
self.assert_image_equal(im, target)
|
||||||
|
self.assertEqual(im.get_format_mimetype(), 'image/sgi')
|
||||||
|
|
||||||
def test_rle(self):
|
def test_rle(self):
|
||||||
# Created with ImageMagick:
|
# Created with ImageMagick:
|
||||||
|
|
|
@ -98,6 +98,8 @@ class SgiImageFile(ImageFile.ImageFile):
|
||||||
|
|
||||||
self._size = xsize, ysize
|
self._size = xsize, ysize
|
||||||
self.mode = rawmode.split(";")[0]
|
self.mode = rawmode.split(";")[0]
|
||||||
|
if self.mode == 'RGB':
|
||||||
|
self.custom_mimetype = 'image/rgb'
|
||||||
|
|
||||||
# orientation -1 : scanlines begins at the bottom-left corner
|
# orientation -1 : scanlines begins at the bottom-left corner
|
||||||
orientation = -1
|
orientation = -1
|
||||||
|
@ -220,7 +222,6 @@ Image.register_decoder("SGI16", SGI16Decoder)
|
||||||
Image.register_open(SgiImageFile.format, SgiImageFile, _accept)
|
Image.register_open(SgiImageFile.format, SgiImageFile, _accept)
|
||||||
Image.register_save(SgiImageFile.format, _save)
|
Image.register_save(SgiImageFile.format, _save)
|
||||||
Image.register_mime(SgiImageFile.format, "image/sgi")
|
Image.register_mime(SgiImageFile.format, "image/sgi")
|
||||||
Image.register_mime(SgiImageFile.format, "image/rgb")
|
|
||||||
|
|
||||||
Image.register_extensions(SgiImageFile.format,
|
Image.register_extensions(SgiImageFile.format,
|
||||||
[".bw", ".rgb", ".rgba", ".sgi"])
|
[".bw", ".rgb", ".rgba", ".sgi"])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user