Closed Sarah-C closed 2 years ago
Hi!
I checked why my dithered image wasn't scaling, and I think it's because it's not supported?
Is there a way of scaling the jpg, then running the ditherer?
// Too big? Then scale. uint8_t scaling = 0; // Get's or'd with options for the following: uint8_t options = 0; /*Decoder options JPEG_AUTO_ROTATE 1 JPEG_SCALE_HALF 2 JPEG_SCALE_QUARTER 4 JPEG_SCALE_EIGHTH 8 JPEG_LE_PIXELS 16 JPEG_EXIF_THUMBNAIL 32 JPEG_LUMA_ONLY 64 */ if (width > 960 || height > 540) { // Try half size. width >>= 1; height >>= 1; Serial.println("Trying half size:"); Serial.println(width); Serial.println(height); scaling = JPEG_SCALE_HALF; if (width > 960 || height > 540) { // Try quarter size. width >>= 1; height >>= 1; scaling = JPEG_SCALE_QUARTER; Serial.println("Trying quarter size:"); Serial.println(width); Serial.println(height); if (width > 960 || height > 540) { // Try eigth size. width >>= 1; height >>= 1; scaling = JPEG_SCALE_EIGHTH; Serial.println("Trying eighth size:"); Serial.println(width); Serial.println(height); if (width > 960 || height > 540) { Serial.println("Still too big after scaling attempt, skipping."); // Still too big, cancel operation, and don't pause for any length of time for next image. waitingTime = 1; return; } // Too big. } // Eighth size. } // Quarter size. } // Half size. // For when this image is smaller than the last - make sure no old image can be seen on the boundaries. canvas.fillCanvas(15); offsetX = (960 - width) >> 1; offsetY = (540 - height) >> 1; jpeg.setPixelType(FOUR_BIT_DITHERED); jpeg.decodeDither(ditherSpace, options || scaling); jpeg.close();
made by mistake. I thought I closed the page without posting. (was my code)
Hi!
I checked why my dithered image wasn't scaling, and I think it's because it's not supported?
Is there a way of scaling the jpg, then running the ditherer?