在几秒钟内转动数百张JPEG,而不是几个小时 [英] Rotating hundreds of JPEGs in seconds rather than hours
问题描述
我们的计算机一次可以获得数百张图片,我们需要尽快旋转和调整图片大小。
旋转完成90,180或270度。
目前我们正在使用命令行工具 GraphicsMagick 来旋转图像。旋转图像(5760 * 3840〜22MP)大约需要4到7秒钟。
以下 python代码可悲地给我们同样的结果
import cv
img = cv.LoadImage(image.jpg)
timg = cv.CreateImage((img.height,img.width),img .depth,img.channels)#转置图像
#逆时针旋转
cv.Transpose(img,timg)
cv.Flip(timg,timg,flipMode = 0 )
cv.SaveImage(rotated_counter_clockwise.jpg,timg)
使用显卡的功能旋转图像的方法? OpenCL和OpenGL让人想起,但我们想知道性能提升是否会引人注目。
我们使用的硬件相当有限,因为设备应尽可能小。
- Intel Atom D525(1.8 Ghz)
- Mobility Radeon HD 5430 Series 4 GB内存
- SSD Vertility 3
该软件是debian 6官方(封闭源代码)radeon驱动程序。
您可以执行只是修改EXIF部分的无损旋转。这可以更快地旋转你的照片。
并查看执行无损JPEG修改的jpegtran实用程序。
http://linuxmanpages.com/man1/jpegtran.1.php
We have hundreds of images which our computer gets at a time and we need to rotate and resize them as fast as possible. Rotation is done by 90, 180 or 270 degrees.
Currently we are using the command line tool GraphicsMagick to rotate the image. Rotating the images (5760*3840 ~ 22MP) takes around 4 to 7 seconds.
The following python code sadly gives us equal results
import cv
img = cv.LoadImage("image.jpg")
timg = cv.CreateImage((img.height,img.width), img.depth, img.channels) # transposed image
# rotate counter-clockwise
cv.Transpose(img,timg)
cv.Flip(timg,timg,flipMode=0)
cv.SaveImage("rotated_counter_clockwise.jpg", timg)
Is there a faster way to rotate the images using the power of the graphics card? OpenCL and OpenGL come to mind but we are wondering whether a performance increase would be noticable.
The hardware we are using is fairly limited as the device should be as small as possible.
- Intel Atom D525 (1,8 Ghz)
- Mobility Radeon HD 5430 Series
- 4 GB of RAM
- SSD Vertility 3
The software is debian 6 with official (closed source) radeon drivers.
you can perform a lossless rotation that will just modify the EXIF section. This will rotate your pictures faster.
and have a look at jpegtran utility which performs lossless jpeg modifications. http://linuxmanpages.com/man1/jpegtran.1.php
这篇关于在几秒钟内转动数百张JPEG,而不是几个小时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!