Skip to main content

Posts

Showing posts with the label operation

Error copying files in Finder of OS X

Problem: I have an SD flash card (8 GB Kingston) and a MacBook Pro 13" (Late 2011 model). I also use external card reader time to time. This problem persisted on all the conditions. The error message was stating: The Finder can’t complete the operation because some data in “” can’t be read or written. (Error code -36) This was happening while copying Photos from my camera (cr2 files). It worked, however, in case of copying files up to 200 MB in total size of batch. It dropped this error message and did stop to copy files upon selecting of lots of RAW files. E.g. all of them and attempting to copy them from a flash drive. Solution: Problem occurred with building miniatures of the CR2 files. Those files are quite heavy photos (25+ MB) and building miniature did take some time. While building those miniatures on both MAC and SD card finder windows it did die. For me it was enough to change the view from icons to list. E.g.: This did solve it for me. Other solution (Suspect...

Django: Rotate Image with PIL usage.

Let's assume we have this simple model: from django.db import models class Image(models.Model): image = models.FileField(upload_to="images/")   Task is to take this simple image, rotate it and save instead of original. Let's discover this way to do so: #views.py from PIL import Image as PilImage from models import Image def rotate(request): #getting instance of the model item=Image.objects.get(pk=1) #opening image for PIL to access im = PilImage.open(image.image) #rotating it by built in PIL command rotated_image = im.rotate(270) #saving rotated image instead of original. Overwriting is on. rotated_image.save(item.image.file.name, overwrite=True) return HttpResponse(str(image.image)) This pattern will work in most cases.  Instead of rotate you can use any other PIL editing method, as for e.g. flip or sharpen the image... Have fun coding and please leave me a comment if you'll find this info useful. ...