Exemplo n.º 1
0
    def test_sid(self):
        # default sid is None
        fi = FileImage(tif_path)
        self.assertIsNone(fi.sid)

        # SID can be set though
        fi2 = FileImage(tif_path, sid=1500)
        self.assertEqual(fi2.sid, 1500)

        # SID also affects the dpi
        orig_dpi = fi.dpi
        scaled_dpi = fi2.dpi
        self.assertEqual(orig_dpi, scaled_dpi*2/3)
Exemplo n.º 2
0
    def test_dpi_dpmm(self):
        # DPI is usually in TIF files
        fi = FileImage(tif_path)
        # shouldn't raise
        fi.dpi
        fi.dpmm

        # not in certain other files
        fi_jpg = FileImage(png_path)
        self.assertIsNone(fi_jpg.dpi)

        # but DPI can be set though
        fi_jpg2 = FileImage(png_path, dpi=100)
        # shouldn't raise
        fi_jpg2.dpi
        fi_jpg2.dpmm
Exemplo n.º 3
0
    def test_dpi_dpmm(self):
        # DPI is usually in TIF files
        fi = FileImage(tif_path)
        # shouldn't raise
        fi.dpi
        fi.dpmm

        # not in certain other files
        fi_jpg = FileImage(png_path)
        with self.assertRaises(AttributeError):
            fi_jpg.dpi
        # but DPI can be set though
        fi_jpg2 = FileImage(png_path, dpi=100)
        # shouldn't raise
        fi_jpg2.dpi
        fi_jpg2.dpmm