PIL “IOError: image file truncated” with big images

I’m a little late to reply here, but I ran into a similar problem and I wanted to share my solution. First, here’s a pretty typical stack trace for this problem: Traceback (most recent call last): … File …, line 2064, in … im.thumbnail(DEFAULT_THUMBNAIL_SIZE, Image.ANTIALIAS) File “/Library/Python/2.7/site-packages/PIL/Image.py”, line 1572, in thumbnail self.load() File “/Library/Python/2.7/site-packages/PIL/ImageFile.py”, line … Read more

Image, saved to sdcard, doesn’t appear in Android’s Gallery app

A simpler solution is to use the static convenience method scanFile(): File imageFile = … MediaScannerConnection.scanFile(this, new String[] { imageFile.getPath() }, new String[] { “image/jpeg” }, null); where this is your activity (or whatever context), the mime-type is only necessary if you are using non-standard file extensions and the null is for the optional callback … Read more

Display a Image in a console application

Though showing an image in a console is not the intended usage of the console, you can surely hack the things, as the console window is just a window, like any other windows. Actually, once I have started to develop a text controls library for console applications with graphics support. I have never finished that, … Read more

How much data / information can we save / store in a QR code?

QR codes have three parameters: Datatype, size (number of ‘pixels’) and error correction level. How much information can be stored there also depends on these parameters. For example the lower the error correction level, the more information that can be stored, but the harder the code is to recognize for readers. The maximum size and … Read more

Batch resize images and output images to new folder with ImageMagick

“Mogrify” should be called from the directory with the original thumbnails, while the -path parameter is for pointing target directory. mkdir public_html/images/new-thumbs cd public_html/images/thumbs magick mogrify -resize 16×12 -quality 100 -path ../new-thumbs *.jpg http://www.imagemagick.org/Usage/basics/#mogrify The last arguments are the list of files, so you can filter by name 1-*.jpg for example.

Load local images in React.js

If you have questions about creating React App I encourage you to read its User Guide. It answers this and many other questions you may have. Specifically, to include a local image you have two options: Use imports: // Assuming logo.png is in the same folder as JS file import logo from ‘./logo.png’; // …later … Read more

Image fingerprint to compare similarity of many images

Normal hashing or CRC calculation algorithms do not work well with image data. The dimensional nature of the information must be taken into account. If you need extremely robust fingerprinting, such that affine transformations (scaling, rotation, translation, flipping) are accounted for, you can use a Radon transformation on the image source to produce a normative … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)