Skip to main content

Posts

Showing posts from January, 2009

Detect identical & black frame in video with ffmpeg?

Thumbnail creation is a very needed feature for any social networking site. Obviously, ffmpeg is the ideal solution for generating thumbnail. Problem-1: Detecting identical thumbnails Fortunately, we have a good solution-- libpuzzle . It would be ideal to have a filter in ffmpeg for that. Problem-2: Detecting black/dark frames I'm still keenly looking for a solution tied up with ffmpeg. When Google turned no help, Heleena (my wife) solved it by calculating average luminance value of the frame and ignoring the frames based on certain preset threshold value--which worked better at that time.

Converting PSD with PHP/ImageMagick

After seeing feature rich options in Imagick PECL extension at Mikko Koppanen 's (the author) website and also impressed with ImageMagick 's features, I have decided to use it for the PSD to XHTML conversion website that I'm architecting and managing. Since, the team wants programming help for converting PSD images, I have tried it (documentation is sparse on PSD handling) Converting PSD to PNG/JPEG/etc Note that, flattenImages() is needed for layered/multi-page PSD file. <?php $im = new Imagick('test.psd'); $im->flattenImages(); $im->setImageFormat('png'); $im->writeImage('test.png'); ?> Extracting PSD layers One by one <?php $im = new Imagick('test.psd'); $im->setImageFormat('png'); for ($i = 0, $num_layers = $im->getNumberImages(); $i < $num_layers; ++$i) { $im->setImageIndex($i); $im->writeImage('layer' . $i . '.png'); } ?> Note that, there is a better version below In