Search in sources :

Example 6 with ImageTransformationOptions

use of org.alfresco.repo.content.transform.magick.ImageTransformationOptions in project alfresco-repository by Alfresco.

the class TransformationOptionsConverterTest method testImageTransformationOptionsResizeWidthHeight.

@Test
public // Checks we do what was in the legacy ImageMagickContentTransformerWorker
void testImageTransformationOptionsResizeWidthHeight() {
    ImageTransformationOptions oldOptions = new ImageTransformationOptions();
    oldOptions.setAutoOrient(false);
    ImageResizeOptions imageResizeOptions = new ImageResizeOptions();
    imageResizeOptions.setAllowEnlargement(false);
    imageResizeOptions.setMaintainAspectRatio(false);
    imageResizeOptions.setWidth(18);
    imageResizeOptions.setHeight(15);
    oldOptions.setResizeOptions(imageResizeOptions);
    assertConverterToMapAndBack(oldOptions, MIMETYPE_IMAGE_JPEG, MIMETYPE_IMAGE_PNG, "ImageTransformationOptions [commandOptions=, " + "resizeOptions=ImageResizeOptions [width=18, height=15, maintainAspectRatio=false, " + "percentResize=false, resizeToThumbnail=false, allowEnlargement=false], autoOrient=false]]", "allowEnlargement=false " + "maintainAspectRatio=false " + "resizeHeight=15 " + "resizeWidth=18 " + "timeout=-1 ", true);
}
Also used : ImageTransformationOptions(org.alfresco.repo.content.transform.magick.ImageTransformationOptions) ImageResizeOptions(org.alfresco.repo.content.transform.magick.ImageResizeOptions) Test(org.junit.Test)

Example 7 with ImageTransformationOptions

use of org.alfresco.repo.content.transform.magick.ImageTransformationOptions in project alfresco-repository by Alfresco.

the class TransformationOptionsConverterTest method testCompositeReformatAndResizeRendition.

@Test
public void testCompositeReformatAndResizeRendition() {
    ImageTransformationOptions oldOptions = new ImageTransformationOptions();
    ImageResizeOptions imageResizeOptions = new ImageResizeOptions();
    imageResizeOptions.setHeight(30);
    imageResizeOptions.setWidth(20);
    oldOptions.setResizeOptions(imageResizeOptions);
    PagedSourceOptions pagedSourceOptions = new PagedSourceOptions();
    pagedSourceOptions.setStartPageNumber(1);
    pagedSourceOptions.setEndPageNumber(1);
    oldOptions.addSourceOptions(pagedSourceOptions);
    assertConverterToMapAndBack(oldOptions, MIMETYPE_IMAGE_JPEG, MIMETYPE_IMAGE_JPEG, "ImageTransformationOptions [commandOptions=, resizeOptions=" + "ImageResizeOptions [width=20, height=30, maintainAspectRatio=true, percentResize=false, " + "resizeToThumbnail=false, allowEnlargement=true], autoOrient=true], " + "sourceOptions={ PagedSourceOptionsPagedSourceOptions {1, 1}} ]", "alphaRemove=true " + "autoOrient=true " + "endPage=0 " + "resizeHeight=30 " + "resizeWidth=20 " + "startPage=0 " + "timeout=-1 ", true);
}
Also used : ImageTransformationOptions(org.alfresco.repo.content.transform.magick.ImageTransformationOptions) ImageResizeOptions(org.alfresco.repo.content.transform.magick.ImageResizeOptions) PagedSourceOptions(org.alfresco.service.cmr.repository.PagedSourceOptions) Test(org.junit.Test)

Example 8 with ImageTransformationOptions

use of org.alfresco.repo.content.transform.magick.ImageTransformationOptions in project alfresco-repository by Alfresco.

the class TransformationOptionsConverterTest method testImageTransformationOptionsAlphaRemove.

@Test
public // Checks we do what was in the legacy ImageMagickContentTransformerWorker
void testImageTransformationOptionsAlphaRemove() {
    ImageTransformationOptions oldOptions = new ImageTransformationOptions();
    oldOptions.setAutoOrient(false);
    // The target mimetype is JPEG, which sets the alphaRemove
    assertConverterToMapAndBack(oldOptions, MIMETYPE_IMAGE_JPEG, MIMETYPE_IMAGE_JPEG, "ImageTransformationOptions [commandOptions=, resizeOptions=null, autoOrient=false]]", "alphaRemove=true " + "timeout=-1 ", true);
}
Also used : ImageTransformationOptions(org.alfresco.repo.content.transform.magick.ImageTransformationOptions) Test(org.junit.Test)

Example 9 with ImageTransformationOptions

use of org.alfresco.repo.content.transform.magick.ImageTransformationOptions in project alfresco-repository by Alfresco.

the class TransformationOptionsConverterTest method testImageTransformationOptionsNoAutoOrient.

@Test
public // Checks we do what was in the legacy ImageMagickContentTransformerWorker
void testImageTransformationOptionsNoAutoOrient() {
    ImageTransformationOptions oldOptions = new ImageTransformationOptions();
    oldOptions.setAutoOrient(false);
    assertConverterToMapAndBack(oldOptions, MIMETYPE_IMAGE_JPEG, MIMETYPE_IMAGE_PNG, "ImageTransformationOptions [commandOptions=, resizeOptions=null, autoOrient=false]]", "timeout=-1 ", true);
}
Also used : ImageTransformationOptions(org.alfresco.repo.content.transform.magick.ImageTransformationOptions) Test(org.junit.Test)

Example 10 with ImageTransformationOptions

use of org.alfresco.repo.content.transform.magick.ImageTransformationOptions in project alfresco-repository by Alfresco.

the class TransformationOptionsConverterTest method testImageTransformationOptionsResizeNoEnlargement.

@Test
public // Checks we do what was in the legacy ImageMagickContentTransformerWorker
void testImageTransformationOptionsResizeNoEnlargement() {
    ImageTransformationOptions oldOptions = new ImageTransformationOptions();
    oldOptions.setAutoOrient(false);
    ImageResizeOptions imageResizeOptions = new ImageResizeOptions();
    imageResizeOptions.setAllowEnlargement(false);
    oldOptions.setResizeOptions(imageResizeOptions);
    assertConverterToMapAndBack(oldOptions, MIMETYPE_IMAGE_JPEG, MIMETYPE_IMAGE_PNG, "ImageTransformationOptions [commandOptions=, " + "resizeOptions=ImageResizeOptions [width=-1, height=-1, maintainAspectRatio=true, " + "percentResize=false, resizeToThumbnail=false, allowEnlargement=false], autoOrient=false]]", "allowEnlargement=false " + "timeout=-1 ", true);
}
Also used : ImageTransformationOptions(org.alfresco.repo.content.transform.magick.ImageTransformationOptions) ImageResizeOptions(org.alfresco.repo.content.transform.magick.ImageResizeOptions) Test(org.junit.Test)

Aggregations

ImageTransformationOptions (org.alfresco.repo.content.transform.magick.ImageTransformationOptions)35 Test (org.junit.Test)26 ImageResizeOptions (org.alfresco.repo.content.transform.magick.ImageResizeOptions)22 NodeRef (org.alfresco.service.cmr.repository.NodeRef)8 PagedSourceOptions (org.alfresco.service.cmr.repository.PagedSourceOptions)8 HashMap (java.util.HashMap)7 AbstractContentTransformerTest (org.alfresco.repo.content.transform.AbstractContentTransformerTest)7 CropSourceOptions (org.alfresco.service.cmr.repository.CropSourceOptions)7 BaseAlfrescoSpringTest (org.alfresco.util.BaseAlfrescoSpringTest)7 Serializable (java.io.Serializable)5 SWFTransformationOptions (org.alfresco.repo.content.transform.swf.SWFTransformationOptions)4 TemporalSourceOptions (org.alfresco.service.cmr.repository.TemporalSourceOptions)3 TransformationSourceOptions (org.alfresco.service.cmr.repository.TransformationSourceOptions)3 File (java.io.File)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 RuntimeExecutableContentTransformerOptions (org.alfresco.repo.content.transform.RuntimeExecutableContentTransformerOptions)2 ThumbnailParentAssociationDetails (org.alfresco.service.cmr.thumbnail.ThumbnailParentAssociationDetails)2 BufferedImage (java.awt.image.BufferedImage)1 Arrays (java.util.Arrays)1