0

ImageAlter: inconsistent transformation results compared to v3

When performing actions scale, crop and rotation together in a single call in version 4 (ImageAlter.transform) the end result is often inconsistent. The images get stretched or condensed, and some calls simply fail.

In what order should the actions be executed to ensure consistent results? I tried different sequences, but none work in all situations. Should I perform the actions separately? (hope not!)

Thanks,

Daniel

6 Replies
  • No, the operations should be performed in order given in the passed 'actions' array. Do you have some sample code you can share?

    --Steve
    0
  • Hi Steve,

    My application displays a thumbnail gallery with all images having a fixed height of 75 pixels. Generally, pictures have a 4:3 ratio, so they get scaled down to 100x75. The application also allows for rotation and cropping of images.

    I am able to scaled and rotate images, but no crop them. The problem is that ImageAlter.transform applies cropping on the original image and not on the intermediate result.

    The sequence of actions I use to ensure a fixed height is:
    CODE
    ...
    // Redraw the thumbnail image
    alterImage(
    {
    file: imgData.file,
    format: IMG_FORMAT,
    quality: WORK_QUALITY,
    actions: [
    { scale: imgData.scale }, // To ensure a fixed height, scaling must be done first
    { rotate: imgData.rotate },
    { crop: imgData.crop }
    ]
    },
    alterImageCb
    );
    ...


    Here is sample data that scales and rotates an image:
    CODE
    {
    actions: [
    { scale: { maxwidth=75} },
    { rotate: 90 },
    { crop: [0.0001, 0.0001, 0.9999, 0.9999] }
    ]
    file: Object { BrowserPlusType="BPTPath", more...}
    format: "jpg"
    quality: 65
    }


    Rotating uncropped images works fine, but you must scale them first to ensure a fixed height. Take a look at http://imagebin.ca/view/Jpqy6kur.html.

    The problem is that cropping an image only works when the dimensions of the crop area is contained within the scaled down image.

    Take a look at the following examples:

    EXAMPLE 1: The crop area is smaller than the scaled down image

    CODE
    Load a 800x600 PNG image
    Scale to a maxheight of 75

    2010-08-26 13:35:35Z [4524:5684] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Quality set to 65 (0-100, worst-best)
    2010-08-26 13:35:35Z [4524:5684] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) 1 transformation actions specified
    2010-08-26 13:35:35Z [4524:5684] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) transform [scale] with args
    2010-08-26 13:35:35Z [4524:5684] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) scaling parameters [mw: 800 | mh: 75]: from (800, 600) to (100, 75)
    2010-08-26 13:35:35Z [4524:5684] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Output to format: JPG
    2010-08-26 13:35:35Z [4524:5684] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Writing 1326 bytes to img.jpg
    2010-08-26 13:35:35Z [4072:4672] INFO - ServiceRunner::Connector::Connector: server running on: BrowserPlus_2.9.8_Daniel Frechette_4072_9
    2010-08-26 13:35:35Z [4072:4672] INFO - ServiceRunner::Controller::run: successfully spawned service process for C:\Users\Daniel Frechette\AppData\Local\Yahoo!\BrowserPlus\Corelets\FileAccess\2.0.1, pid: 668 - waiting for connection on BrowserPlus_2.9.8_Daniel Frechette_4072_9
    2010-08-26 13:35:35Z [668:2520] INFO - ServiceRunner::runServiceProcess: Service Process running
    2010-08-26 13:35:35Z [668:2520] INFO - ServiceRunner::ServiceLibrary::load: loading corelet library: FileAccess.dll
    2010-08-26 13:35:35Z [668:2520] INFO - ServiceRunner::runServiceProcess: Service Process loaded FileAccess v2.0.1 successfully in 0.001s
    2010-08-26 13:35:35Z [668:2520] INFO - ServiceRunner::runServiceProcess: Service Process (FileAccess) connecting to ipc: BrowserPlus_2.9.8_Daniel Frechette_4072_9
    2010-08-26 13:35:35Z [4072:4672] INFO - ServiceRunner::Controller::onConnected: Received connected IPC channel for FileAccess v2.0.1 in 0.084s
    2010-08-26 13:35:35Z [668:6568] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) ctor, tempDir = C:\Users\DANIEL~1\AppData\Local\Temp\SerF197.tmp
    2010-08-26 13:35:35Z [668:6568] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) bp::http::server::Server::Impl::bind: port = 50121
    2010-08-26 13:35:35Z [668:6568] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) bp::http::server::Server::Impl::mount: 03033828 mounted for *
    2010-08-26 13:35:35Z [668:6568] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) Bound to: 127.0.0.1:50121
    2010-08-26 13:35:35Z [668:6568] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) getURL
    2010-08-26 13:35:35Z [668:2388] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) request.url.path = /a463d0a3-5bb4-40c7-ac31-cc9f0120a717
    2010-08-26 13:35:35Z [668:2388] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) token 'a463d0a3-5bb4-40c7-ac31-cc9f0120a717' extracted from request path: /a463d0a3-5bb4-40c7-ac31-cc9f0120a717
    2010-08-26 13:35:38Z [4524:5684] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Attempting to read 11335 bytes from 'C:\Users\Daniel Frechette\Pictures\test.png'
    2010-08-26 13:35:38Z [4524:5684] ERROR - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) read img: 0305A9B0
    2010-08-26 13:35:38Z [4524:5684] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Image contains 1 frames, type: PNG

    Create a crop image (used to select the crop area)

    2010-08-26 13:35:38Z [4524:5684] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Quality set to 65 (0-100, worst-best)
    2010-08-26 13:35:38Z [4524:5684] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) 2 transformation actions specified
    2010-08-26 13:35:38Z [4524:5684] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) transform [rotate] with args
    2010-08-26 13:35:38Z [4524:5684] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) transform [scale] with args
    2010-08-26 13:35:38Z [4524:5684] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) scaling parameters [mw: 800 | mh: 300]: from (800, 600) to (400, 300)
    2010-08-26 13:35:38Z [4524:5684] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Output to format: JPG
    2010-08-26 13:35:38Z [4524:5684] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Writing 5732 bytes to img.jpg
    2010-08-26 13:35:38Z [668:6568] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) getURL
    2010-08-26 13:35:38Z [668:3440] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) request.url.path = /fb6748de-1056-4fca-a511-51fefeddbedb
    2010-08-26 13:35:38Z [668:3440] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) token 'fb6748de-1056-4fca-a511-51fefeddbedb' extracted from request path: /fb6748de-1056-4fca-a511-51fefeddbedb
    2010-08-26 13:35:43Z [4524:5684] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Attempting to read 11335 bytes from 'C:\Users\Daniel Frechette\Pictures\test.png'
    2010-08-26 13:35:43Z [4524:5684] ERROR - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) read img: 03024AA8
    2010-08-26 13:35:43Z [4524:5684] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Image contains 1 frames, type: PNG

    Crop the original image to dimensions that are less than 100x75

    2010-08-26 13:35:43Z [4524:5684] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Quality set to 65 (0-100, worst-best)
    2010-08-26 13:35:43Z [4524:5684] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) 2 transformation actions specified
    2010-08-26 13:35:43Z [4524:5684] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) transform [scale] with args
    2010-08-26 13:35:43Z [4524:5684] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) scaling parameters [mw: 800 | mh: 75]: from (800, 600) to (100, 75)
    2010-08-26 13:35:43Z [4524:5684] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) transform [crop] with args
    2010-08-26 13:35:43Z [4524:5684] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Cropping image (800x600): 69x51 starting at 0,0
    2010-08-26 13:35:43Z [4524:5684] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Output to format: JPG
    2010-08-26 13:35:43Z [4524:5684] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Writing 852 bytes to img.jpg
    2010-08-26 13:35:43Z [668:6568] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) getURL
    2010-08-26 13:35:43Z [668:5048] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) request.url.path = /a15a571b-94a1-422b-b57d-0b64fef0592a
    2010-08-26 13:35:43Z [668:5048] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) token 'a15a571b-94a1-422b-b57d-0b64fef0592a' extracted from request path: /a15a571b-94a1-422b-b57d-0b64fef0592a


    Example 1 returns the cropped area.

    EXAMPLE 2: The crop area is larger than the scaled down image, but its start coordinates are within the scaled down image

    CODE
    Load a 800x600 PNG image
    Scale to a maxheight of 75

    2010-08-26 13:39:27Z [6636:4260] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Quality set to 65 (0-100, worst-best)
    2010-08-26 13:39:27Z [6636:4260] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) 1 transformation actions specified
    2010-08-26 13:39:27Z [6636:4260] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) transform [scale] with args
    2010-08-26 13:39:27Z [6636:4260] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) scaling parameters [mw: 800 | mh: 75]: from (800, 600) to (100, 75)
    2010-08-26 13:39:27Z [6636:4260] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Output to format: JPG
    2010-08-26 13:39:27Z [6636:4260] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Writing 1326 bytes to img.jpg
    2010-08-26 13:39:27Z [4072:4672] INFO - ServiceRunner::Connector::Connector: server running on: BrowserPlus_2.9.8_Daniel Frechette_4072_12
    2010-08-26 13:39:27Z [4072:4672] INFO - ServiceRunner::Controller::run: successfully spawned service process for C:\Users\Daniel Frechette\AppData\Local\Yahoo!\BrowserPlus\Corelets\FileAccess\2.0.1, pid: 6244 - waiting for connection on BrowserPlus_2.9.8_Daniel Frechette_4072_12
    2010-08-26 13:39:27Z [6244:5132] INFO - ServiceRunner::runServiceProcess: Service Process running
    2010-08-26 13:39:27Z [6244:5132] INFO - ServiceRunner::ServiceLibrary::load: loading corelet library: FileAccess.dll
    2010-08-26 13:39:27Z [6244:5132] INFO - ServiceRunner::runServiceProcess: Service Process loaded FileAccess v2.0.1 successfully in 0.001s
    2010-08-26 13:39:27Z [6244:5132] INFO - ServiceRunner::runServiceProcess: Service Process (FileAccess) connecting to ipc: BrowserPlus_2.9.8_Daniel Frechette_4072_12
    2010-08-26 13:39:27Z [4072:4672] INFO - ServiceRunner::Controller::onConnected: Received connected IPC channel for FileAccess v2.0.1 in 0.098s
    2010-08-26 13:39:27Z [6244:4368] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) ctor, tempDir = C:\Users\DANIEL~1\AppData\Local\Temp\Ser7A49.tmp
    2010-08-26 13:39:27Z [6244:4368] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) bp::http::server::Server::Impl::bind: port = 50181
    2010-08-26 13:39:27Z [6244:4368] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) bp::http::server::Server::Impl::mount: 03043828 mounted for *
    2010-08-26 13:39:27Z [6244:4368] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) Bound to: 127.0.0.1:50181
    2010-08-26 13:39:27Z [6244:4368] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) getURL
    2010-08-26 13:39:27Z [6244:5372] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) request.url.path = /341edbf6-11da-4d80-a77b-01e9570bc531
    2010-08-26 13:39:27Z [6244:5372] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) token '341edbf6-11da-4d80-a77b-01e9570bc531' extracted from request path: /341edbf6-11da-4d80-a77b-01e9570bc531
    2010-08-26 13:39:29Z [6636:4260] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Attempting to read 11335 bytes from 'C:\Users\Daniel Frechette\Pictures\test.png'
    2010-08-26 13:39:29Z [6636:4260] ERROR - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) read img: 02DE9B60
    2010-08-26 13:39:29Z [6636:4260] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Image contains 1 frames, type: PNG

    Create a crop image (used to select the crop area)

    2010-08-26 13:39:29Z [6636:4260] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Quality set to 65 (0-100, worst-best)
    2010-08-26 13:39:29Z [6636:4260] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) 2 transformation actions specified
    2010-08-26 13:39:29Z [6636:4260] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) transform [rotate] with args
    2010-08-26 13:39:29Z [6636:4260] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) transform [scale] with args
    2010-08-26 13:39:29Z [6636:4260] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) scaling parameters [mw: 800 | mh: 300]: from (800, 600) to (400, 300)
    2010-08-26 13:39:29Z [6636:4260] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Output to format: JPG
    2010-08-26 13:39:29Z [6636:4260] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Writing 5732 bytes to img.jpg
    2010-08-26 13:39:29Z [6244:4368] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) getURL
    2010-08-26 13:39:29Z [6244:1844] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) request.url.path = /9611edef-0ad2-4a89-bf81-bec2f60990ef
    2010-08-26 13:39:29Z [6244:1844] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) token '9611edef-0ad2-4a89-bf81-bec2f60990ef' extracted from request path: /9611edef-0ad2-4a89-bf81-bec2f60990ef
    2010-08-26 13:39:34Z [6636:4260] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Attempting to read 11335 bytes from 'C:\Users\Daniel Frechette\Pictures\test.png'
    2010-08-26 13:39:34Z [6636:4260] ERROR - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) read img: 02DE9B60
    2010-08-26 13:39:34Z [6636:4260] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Image contains 1 frames, type: PNG

    Attempt to crop the original image to dimensions that are larger than 100x75 starting at position 0,0

    2010-08-26 13:39:34Z [6636:4260] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Quality set to 65 (0-100, worst-best)
    2010-08-26 13:39:34Z [6636:4260] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) 2 transformation actions specified
    2010-08-26 13:39:34Z [6636:4260] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) transform [scale] with args
    2010-08-26 13:39:34Z [6636:4260] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) scaling parameters [mw: 800 | mh: 75]: from (800, 600) to (100, 75)
    2010-08-26 13:39:34Z [6636:4260] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) transform [crop] with args
    2010-08-26 13:39:34Z [6636:4260] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Cropping image (800x600): 433x325 starting at 0,0
    2010-08-26 13:39:34Z [6636:4260] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Output to format: JPG
    2010-08-26 13:39:34Z [6636:4260] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Writing 1326 bytes to img.jpg
    2010-08-26 13:39:34Z [6244:4368] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) getURL
    2010-08-26 13:39:34Z [6244:3084] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) request.url.path = /275adee6-0b86-488c-8a63-0a01cbb6dfce
    2010-08-26 13:39:34Z [6244:3084] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) token '275adee6-0b86-488c-8a63-0a01cbb6dfce' extracted from request path: /275adee6-0b86-488c-8a63-0a01cbb6dfce

    An uncropped version of the image is returned
    No error is returned


    Example 2 returns a scaled down image with no cropping applied. No errors are returned. However, it should trigger an error/exception.

    EXAMPLE 3: The crop area is larger than the scaled down image and outside of the scaled down image

    CODE
    Load a 800x600 PNG image
    Scale to a maxheight of 75

    2010-08-26 13:54:41Z [1116:2772] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Quality set to 65 (0-100, worst-best)
    2010-08-26 13:54:41Z [1116:2772] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) 1 transformation actions specified
    2010-08-26 13:54:41Z [1116:2772] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) transform [scale] with args
    2010-08-26 13:54:41Z [1116:2772] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) scaling parameters [mw: 800 | mh: 75]: from (800, 600) to (100, 75)
    2010-08-26 13:54:41Z [1116:2772] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Output to format: JPG
    2010-08-26 13:54:41Z [1116:2772] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Writing 1326 bytes to img.jpg
    2010-08-26 13:54:41Z [6692:5684] INFO - ServiceRunner::Connector::Connector: server running on: BrowserPlus_2.9.8_Daniel Frechette_6692_6
    2010-08-26 13:54:41Z [6692:5684] INFO - ServiceRunner::Controller::run: successfully spawned service process for C:\Users\Daniel Frechette\AppData\Local\Yahoo!\BrowserPlus\Corelets\FileAccess\2.0.1, pid: 5756 - waiting for connection on BrowserPlus_2.9.8_Daniel Frechette_6692_6
    2010-08-26 13:54:41Z [5756:2468] INFO - ServiceRunner::runServiceProcess: Service Process running
    2010-08-26 13:54:41Z [5756:2468] INFO - ServiceRunner::ServiceLibrary::load: loading corelet library: FileAccess.dll
    2010-08-26 13:54:41Z [5756:2468] INFO - ServiceRunner::runServiceProcess: Service Process loaded FileAccess v2.0.1 successfully in 0s
    2010-08-26 13:54:41Z [5756:2468] INFO - ServiceRunner::runServiceProcess: Service Process (FileAccess) connecting to ipc: BrowserPlus_2.9.8_Daniel Frechette_6692_6
    2010-08-26 13:54:41Z [6692:5684] INFO - ServiceRunner::Controller::onConnected: Received connected IPC channel for FileAccess v2.0.1 in 0.093s
    2010-08-26 13:54:41Z [5756:6156] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) ctor, tempDir = C:\Users\DANIEL~1\AppData\Local\Temp\Ser6DF4.tmp
    2010-08-26 13:54:41Z [5756:6156] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) bp::http::server::Server::Impl::bind: port = 50305
    2010-08-26 13:54:41Z [5756:6156] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) bp::http::server::Server::Impl::mount: 00A73828 mounted for *
    2010-08-26 13:54:41Z [5756:6156] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) Bound to: 127.0.0.1:50305
    2010-08-26 13:54:41Z [5756:6156] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) getURL
    2010-08-26 13:54:41Z [5756:6604] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) request.url.path = /27f128d5-5d87-45e6-ae20-0016e38ad731
    2010-08-26 13:54:41Z [5756:6604] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) token '27f128d5-5d87-45e6-ae20-0016e38ad731' extracted from request path: /27f128d5-5d87-45e6-ae20-0016e38ad731
    2010-08-26 13:54:45Z [1116:2772] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Attempting to read 11335 bytes from 'C:\Users\Daniel Frechette\Pictures\test.png'
    2010-08-26 13:54:45Z [1116:2772] ERROR - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) read img: 02F0EDD0
    2010-08-26 13:54:45Z [1116:2772] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Image contains 1 frames, type: PNG

    Create a crop image (used to select the crop area)

    2010-08-26 13:54:45Z [1116:2772] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Quality set to 65 (0-100, worst-best)
    2010-08-26 13:54:45Z [1116:2772] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) 2 transformation actions specified
    2010-08-26 13:54:45Z [1116:2772] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) transform [rotate] with args
    2010-08-26 13:54:45Z [1116:2772] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) transform [scale] with args
    2010-08-26 13:54:45Z [1116:2772] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) scaling parameters [mw: 800 | mh: 300]: from (800, 600) to (400, 300)
    2010-08-26 13:54:45Z [1116:2772] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Output to format: JPG
    2010-08-26 13:54:45Z [1116:2772] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Writing 5732 bytes to img.jpg
    2010-08-26 13:54:45Z [5756:6156] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) getURL
    2010-08-26 13:54:45Z [5756:4268] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) request.url.path = /d2031b09-999b-466d-bb41-45a485ca03fe
    2010-08-26 13:54:45Z [5756:4268] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (FileAccess 2.0.1) token 'd2031b09-999b-466d-bb41-45a485ca03fe' extracted from request path: /d2031b09-999b-466d-bb41-45a485ca03fe
    2010-08-26 13:54:52Z [1116:2772] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Attempting to read 11335 bytes from 'C:\Users\Daniel Frechette\Pictures\test.png'
    2010-08-26 13:54:52Z [1116:2772] ERROR - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) read img: 02ED65E0
    2010-08-26 13:54:52Z [1116:2772] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Image contains 1 frames, type: PNG

    Attempt to crop the original image to dimensions that are larger than 100x75 starting at position 580,439 (which is outside of the scaled size)

    2010-08-26 13:54:52Z [1116:2772] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Quality set to 65 (0-100, worst-best)
    2010-08-26 13:54:52Z [1116:2772] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) 3 transformation actions specified
    2010-08-26 13:54:52Z [1116:2772] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) transform [scale] with args
    2010-08-26 13:54:52Z [1116:2772] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) scaling parameters [mw: 800 | mh: 75]: from (800, 600) to (100, 75)
    2010-08-26 13:54:52Z [1116:2772] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) transform [rotate] with args
    2010-08-26 13:54:52Z [1116:2772] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) transform [crop] with args
    2010-08-26 13:54:52Z [1116:2772] INFO - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) Cropping image (800x600): 219x159 starting at 580,439
    2010-08-26 13:54:52Z [1116:2772] ERROR - ServiceRunner::ServiceLibrary::logServiceEvent: (ImageAlter 4.0.4) couldn't transform image: unknown
    2010-08-26 13:54:52Z [6692:5684] WARN - ActiveSession::executionFailure: [029C5810] execute transaction 1007 failed
    2010-08-26 13:54:52Z [6692:5684] INFO - ActiveSession::executionFailure: [029C5810:1007] bp.transformFailed: unknown

    ERROR!!!


    Example 3 ends with an error/exception.

    So... what do I have to do to get the desired results (i.e. allow cropping and rotation of scaled fixed height images)?

    Thank you very much for taking the time to analyze this post.

    Daniel
    0
  • OK, I've done it. I made test cases to point out various problems with ImageAlter.transform (v4.0.4).

    Please take a look at http://filebin.ca/vczym (it's a PDF document).

    Regards,

    Daniel
    0
  • I reverted my code back to version 3 and it's working perfectly.

    Version 4 is "barely usable" if you limit the number of actions per transformation to 1 or 2. Trying to rotate, crop and scale all at once will definitely fail. Be aware that scaling often causes the resulting image to look stretched or compressed.

    Regards,

    -- Daniel
    0
  • We released ImageAlter 4.0.5 today. This address the issues with scaling. Check it out with Service Explorer.

    --Steve
    0
  • Hi Steven,

    I compared version 3.0.2 with 4.0.5 and found inconsistencies when rotating an image to 90 and 270 degrees and cropping at the same time.

    Here are my test cases:

    Test case #1:
    Using ImageAlter 4.0.5:

    • quality: 90
    • format: jpeg
    • actions: [{"rotate":0},{"crop": [0.4533333333333333, 0.6075, 0.82, 0.8075]}, {"thumbnail":{"maxheight":100}}]


    Using ImageAlter 3.0.2:

    • crop: {"x1":0.4533333333333333,"y1":0.6075,"x2":0.82,"y2":0.8075}
    • max height: 100
    • rotation: 0
    • quality: 90
    • format: jpeg


    Conclusion: Identical results. Works as expected in both versions


    Test case #2:
    Using ImageAlter 4.0.5:

    • quality: 90
    • format: jpeg
    • actions: [{"rotate":90},{"crop": [0.1925, 0.4533333333333333, 0.39249999999999996, 0.82]}, {"thumbnail":{"maxheight":100}}]


    Using ImageAlter 3.0.2:

    • crop: {"x1":0.1925,"y1":0.4533333333333333,"x2":0.39249999999999996,"y2":0.82}
    • max height: 100
    • rotation: 90
    • quality: 990
    • format: jpeg


    Conclusion: The result of v4.0.5 is wrong.


    Test case #3:
    Using ImageAlter 4.0.5:

    • quality: 90
    • format: jpeg
    • actions: [{"rotate":180},{"crop": [0.18000000000000005, 0.1925, 0.5466666666666666, 0.39249999999999996] }, {"thumbnail":{"maxheight":100}}]


    Using ImageAlter 3.0.2:

    • crop: {"x1":0.18000000000000005,"y1":0.1925,"x2":0.5466666666666666,"y2":0.39249999999999996}
    • max height: 100
    • rotation: 180
    • quality: 990
    • format: jpeg


    Conclusion: Identical results. Works as expected in both versions


    Test case #4:
    Using ImageAlter 4.0.5:

    • quality: 90
    • format: jpeg
    • actions: [{"rotate":270},{"crop": [0.6075, 0.18000000000000005, 0.8075, 0.5466666666666666] }, {"thumbnail":{"maxheight":100}}]


    Using ImageAlter 3.0.2:

    • crop: {"x1":0.6075,"y1":0.18000000000000005,"x2":0.8075,"y2":0.5466666666666666}
    • max height: 100
    • rotation: 270
    • quality: 990
    • format: jpeg


    Conclusion: The result of v4.0.5 is wrong.


    Regards,

    -- Daniel
    0
This forum is locked.

Recent Posts

in Support & General Questions