Month: June 2016

Python: PIL generates an image too big?

You’ve tried thumbnail(), resize(), save(quality=20),  but you still get an image too big? Maybe it’s because you are generating a PNG file.  Change it to JPG and you will get a much smaller file ! It’s because PNG format is a lossless compression file format.  Without losing quality you can’t get a considerably small image …

Python: PIL generates an image too big? Read More »

Let Django’s migration run raw SQL

You’ve created a new column and you want set its value as the "id" column. What to do?  Add the following line to the generated migration file or you can create new migration file migrations.RunSQL(sql=”update some_table set new_column = id”)