Rotate image in imageviewer while dowload it is not updated file

Questions, comments and suggestions concerning VintaSoft Imaging .NET SDK.

Moderator: Alex

Post Reply
satish.trivedi
Posts: 10
Joined: Tue Sep 12, 2023 11:26 am

Rotate image in imageviewer while dowload it is not updated file

Post by satish.trivedi »

Using below code we are able to rotate image. However, it does not update in folder (VintasoftCache\some-guid\Tiles). Therefore while we download image file, it download original file not the file which has update of rotation.
Additionally how we can use below API's
../vintasoft/api/MyVintasoftImageProcessingApi/Rotate
../vintasoft/api/MyVintasoftImageApi/GetImagesInfo

Code for rotate image:

Code: Select all

var imageViewer = docViewer.get_ImageViewer();
var focusedImageIndex = imageViewer.get_FocusedIndex();
if (focusedImageIndex !== -1) {
    var focusedImageRotationAngle = imageViewer.getCustomImageRotationAngle(focusedImageIndex);
    if (focusedImageRotationAngle === -1)
        focusedImageRotationAngle = imageViewer.get_ImageRotationAngle();
    imageViewer.setCustomImageRotationAngle(focusedImageIndex, focusedImageRotationAngle + 90);
}
Alex
Site Admin
Posts: 2319
Joined: Thu Jul 10, 2008 2:21 pm

Re: Rotate image in imageviewer while dowload it is not updated file

Post by Alex »

Hello,

The WebImageViewerJS.setCustomImageRotationAngle function sets the custom rotation angle for image in web image viewer, i.e. the source image is not changed (rotated).

If you want to rotate the source image, you need to use the WebRotateCommandJS class.
Please read how to process (rotate) an image in web application here: https://www.vintasoft.com/docs/vsimagin ... ation.html

If you want to evaluate the ability to rotate source image in web image viewer, please do the following test:
  • Open on-line version of VintaSoft ASP.NET Core Imaging Demo: https://demos.vintasoft.com/AspNetCoreImagingDemo/
  • Open "Image processing" tab in the side panel.
  • Select the "Rotate" command in the command list.
  • Click the "Settings" button, the "Settings" dialog will appear, specify desired rotation angle, close the "Settings" dialog.
  • Click the "Apply" button and see the result.
Best regards, Alexander
satish.trivedi
Posts: 10
Joined: Tue Sep 12, 2023 11:26 am

Re: Rotate image in imageviewer while dowload it is not updated file

Post by satish.trivedi »

Thanks Alex.

Using the below code we are able to rotate and physically able to save drive.

Code: Select all

let focusedIndexvalue = imageViewer.get_FocusedIndex();
if (focusedIndexvalue > -1) {
    var instance = new Vintasoft.Imaging.ImageProcessing.WebRotateCommandJS();
    instance.set_Angle(90);
    //var value = instance.get_Angle();//Existing Angle of Image
    instance.execute(docViewer.get_ImageViewer().get_Images().getImage(focusedIndexvalue),
        isImageProcessing_success, errorImageProcessing_callback
    );
}
However, as we can rotate using WebImageViewerJS.setCustomImageRotationAngle as well, which is for image in web image viewer. This mean, if we rotate using setCustomImageRotationAngle then there no way to save it physically.

What could be use/purpose of it, if it can not save final result/view for the user?

In our workflow, user do not like to save it immediately physically after rotating. Once all the pages done (few pages done with required rotation) then only it should save to the drive. Is there any way to do achieve it?
Alex
Site Admin
Posts: 2319
Joined: Thu Jul 10, 2008 2:21 pm

Re: Rotate image in imageviewer while dowload it is not updated file

Post by Alex »

Hello,

You can determine the rotation angle for image in the web image viewer as follows:
  • If the WebImageViewerJS.getCustomImageRotationAngle function returns -1, image has rotation angle specified by the WebImageViewerJS.get_ImageRotationAngle function.
  • If the WebImageViewerJS.getCustomImageRotationAngle function returns 0, 90, 180 or 270, image has rotation angle specified by the WebImageViewerJS.getCustomImageRotationAngle function.
Please determine the rotation angle for image and rotate image only when you want to save changes in file.

Best regards, Alexander
satish.trivedi
Posts: 10
Joined: Tue Sep 12, 2023 11:26 am

Re: Rotate image in imageviewer while dowload it is not updated file

Post by satish.trivedi »

Thanks Alex for your suggestion.

There it seems slowness while saving a big document after rotating multiple page and save.

As user may rotate multiple page in a document, however, while try to save. We need to execute (call api) multiple time.

For example if user has rotate page number 1, 3, 5, 10. Below code need to run 4 times. How we can achieve this in once and resolve issue of slowness?

instance.execute(docViewer.get_ImageViewer().get_Images().getImage(PageIndexvalue),
isImageProcessing_success, errorImageProcessing_callback
);
Alex
Site Admin
Posts: 2319
Joined: Thu Jul 10, 2008 2:21 pm

Re: Rotate image in imageviewer while dowload it is not updated file

Post by Alex »

Hello,

VintaSoft JavaScript API allows to rotate single image and save changes in source file.

If you need JavaScript API that allows to rotate several images and save changes in source file, you need to create necessary API by yourself, i.e. you need to do the following steps:
  • Create JavaScript code that sends requests to the web service.
  • Create the web service action that rotates several images and saves changes in source file.
Best regards, Alexander
satish.trivedi
Posts: 10
Joined: Tue Sep 12, 2023 11:26 am

Re: Rotate image in imageviewer while dowload it is not updated file

Post by satish.trivedi »

Thanks Alex. We will check this. However, is there any plan from vintasoft in future release for the same? As this will make system faster.
Alex
Site Admin
Posts: 2319
Joined: Thu Jul 10, 2008 2:21 pm

Re: Rotate image in imageviewer while dowload it is not updated file

Post by Alex »

Thank you for suggestion.
Alex
Site Admin
Posts: 2319
Joined: Thu Jul 10, 2008 2:21 pm

Re: Rotate image in imageviewer while dowload it is not updated file

Post by Alex »

Hello,

VintaSoft Imaging .NET SDK 12.3 has been released today. In this version web thumbnail viewer has context menu that allows to rotate thumbnail view in thumbnail viewer.

Best regards, Alexander
Post Reply