Get all fundamental properties of the image. Store in the instance.
(self)
| 154 | |
| 155 | |
| 156 | def get_image_properties(self) -> None: |
| 157 | """Get all fundamental properties of the image. Store in the instance.""" |
| 158 | if self.crc == True: |
| 159 | Png.check_crc(self.bin, 8) |
| 160 | |
| 161 | self.width = int.from_bytes(self.bin[16:20], byteorder="big") |
| 162 | self.height = int.from_bytes(self.bin[20:24], byteorder="big") |
| 163 | # Ranging in 1, 2, 4, 8, 16 |
| 164 | self.bit_depth = self.bin[24] |
| 165 | # Ranging in 0, 2, 3, 4, 6 |
| 166 | # 0 - Grayscale - 1 channel |
| 167 | # 2 - RGB - 3 channels |
| 168 | # 3 - Palette - 1 channel |
| 169 | # 4 - Grayscale Alpha - 2 channels |
| 170 | # 6 - RGB Alpha - 4 channels |
| 171 | self.color_type = self.bin[25] |
| 172 | self.channels = Png.channels_lookup[self.color_type] |
| 173 | # default 0 |
| 174 | self.compression_method = self.bin[26] |
| 175 | # default 0 |
| 176 | self.filter_method = self.bin[27] |
| 177 | # 0 - no interlace |
| 178 | # 1 - Adam7 algorithm |
| 179 | self.interlace_method = self.bin[28] |
| 180 | |
| 181 | |
| 182 | def get_palette(self) -> None: |