1

I have removed the metadata from an image using the below imagemagick command.

convert input.png -strip output.png

It almost reduces 20% of the size for the 2MB file.

I need to do the same using Jmagick java api.

Is there any api available in Jmagick to remove the metadata?

Querier
  • 185
  • 1
  • 1
  • 10

2 Answers2

1

I can't read Java, but there seems to be a strip method in src/magick/magick_MagickImage.c:

/*
 * Class:     magick_MagickImage
 * Method:    strip
 * Signature: ()Z
 */
JNIEXPORT jboolean JNICALL Java_magick_MagickImage_strip
    (JNIEnv *env, jobject self) {
    Image *image = NULL;
    jboolean retVal;

    image = (Image*) getHandle(env, self, "magickImageHandle", NULL);
    if (image == NULL) {
    throwMagickException(env, "Unable to retrieve image handle");
    return JNI_FALSE;
    }

    retVal = StripImage(image);
    return(retVal);
}
Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
1

It depends on the version you are using!

JMagick up to version 6.7.7:

MagickImage has no method strip()

Current (Master) JMagick version:

MagickImage has a method named strip()

ltlBeBoy
  • 1,242
  • 16
  • 23