Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Image Compression in AEM

Avatar

Avatar
Validate 25
Level 3
vdhim23
Level 3

Like

1 like

Total Posts

135 posts

Correct Reply

9 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile

Avatar
Validate 25
Level 3
vdhim23
Level 3

Like

1 like

Total Posts

135 posts

Correct Reply

9 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile
vdhim23
Level 3

17-04-2018

Hi,

I am using ImageQuick Tool to compress the DAM images. I am using below snippet for conversion.

try {

   System.out.println(" Image is Processing :: " + assetDetails.getName() + "Original Size :: " + assetDetails.getSize());

   ProcessBuilder pb = new ProcessBuilder("C:\\Program Files\\ImageMagick-6.9.9-Q16\\convert.exe", "-quality", "85%", assetDetails.getAssetNode().getPath(), assetDetails.getAssetNode().getPath());

  pb.redirectErrorStream(true);

   Process p = pb.start();

   BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));

   String line = null;

   while ((line = br.readLine()) != null) {

   System.out.println(line);

   }

   System.out.println(p.waitFor());

  session.save();

   } catch (final IOException | RepositoryException | InterruptedException ex) {

  ex.printStackTrace();

   }

Getting an error as below :

Image is Processing :: A.jpgOriginal Size :: 323.8 KB

convert.exe: unable to open image `/content/dam/A.jpg': No such file or directory @ error/blob.c/OpenBlob/2761.

convert.exe: no images defined `/content/dam/A.jpg' @ error/convert.c/ConvertImageCommand/3258.

Here code is looking for the file from /content/dam from local. How can I do this operation on existing images.

In case, I add the server name before path, I am getting below error :

convert.exe: no decode delegate for this image format `' @ error/constitute.c/ReadImage/504.

convert.exe: no data returned `http://localhost:4502/content/dam/A.jpg' @ error/url.c/ReadURLImage/247.

convert.exe: no images defined `http://localhost:4502/content/dam/A.jpg' @ error/convert.c/ConvertImageCommand/3258.

Thanks,

Replies

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

17-04-2018

We have asked the Asset team to help you here.

In mean time - look at this community thread - imagemagick - How can we compress images in DAM AEM6.3? - Stack Overflow