cancel
Showing results for 
Search instead for 
Did you mean: 

Transform a image with Javascript

larade
Confirmed Champ
Confirmed Champ
Hello,  I have a problem to transform an image. I use a javascript script found in the Alfresco documentation. My version is 5.2.  The script :

// convert an image to JPG format and resize to thumbnail image
var thumbImage = document.transformImage('image/jpeg', '-resize 120');

The log:
ERROR [org.alfresco.repo.jscript.ScriptNode] [defaultAsyncAction4] 08110207 Unsupported transformation: transformer.ImageMagick image/jpeg to image/png

Screenshot :


The image is well converted but the resize does not work. The mimetype (property of the image) can not change.
Being a beginner, I can not understand the log message.
Thank you in advance for your help.
Olivier
13 REPLIES 13

mehe
Elite Collaborator
Elite Collaborator

...unfortunally my jpeg has no Exif information, but I think the EXIF tags are not updated by imagemagick's convert.

identify shows nothing:

identify -format '%[EXIF:*]' myimage.jpg

exiftool shows info, but I think because there is no data, exiftool reads it from the physical jpeg data:

---- JFIF ----
JFIF Version : 1.01
Resolution Unit : cm
X Resolution : 28
Y Resolution : 28
---- Composite ----
Image Size : 120x27
Megapixels : 0.003

if you could provide a sample, I could test the conversion...

larade
Confirmed Champ
Confirmed Champ
For example, the image I put in attachment has a size of 313X234, after conversion, properties other than the Mime / type have not changed. Actually, the command does not update the exifs, so the software or I have to insert the image Bmp does not accept. I think my problem will not be solved. I have at least advanced on the understanding of the operation of Alfresco.Thanks again Martin 🙂

mehe
Elite Collaborator
Elite Collaborator

What you can do: Configure a special transformer for your thumbnails and define a shell script/batchfile/Pythonprog/Javaclass for the conversion where the exif info is updated.

See Content Transformers (and Renditions) | Alfresco Documentation 

The conversion done by Image magic convert seems to strip the exif information...

larade
Confirmed Champ
Confirmed Champ
Thank you Martin for the time spent :-).
I'm going to move in that direction.
Have a good evening 🙂


Olivier