Big TIF image processing

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

Moderator: Alex

Post Reply
damian.tomas
Posts: 5
Joined: Tue Aug 22, 2017 10:28 am

Big TIF image processing

Post by damian.tomas »

Dear All,

this is my first post here so I'd like to say Hello.
I have a problem during big TIF images conversion in my C#. I would like to resize an image with resolution 4800x47820 and pixel format bgr24. I've created a declaration of resize command, set interpolation mode to nearest neighbor and during execution I have a message "Cannot create bitmap (Width=4800, Height=47820, PixelFormat=Bgr24)". Does someone maybe know how can I proceed further with this issue? I've tried also with resize function directly on image. I know that system would like to allocate memory for this bitmap and it is not sufficient but maybe someone knows some workaround for this? In demo provided by VintaSoft I don't have this problem but I see that a code is created in some different way there. I tried to split my image to the part and then resize each part but in the end I am not able to merge them into one image because it also tries to do it with bitmaps.

I would be very thankful for any help.
Damian
Alex
Site Admin
Posts: 2304
Joined: Thu Jul 10, 2008 2:21 pm

Re: Big TIF image processing

Post by Alex »

Hello Damian,

Raster Grid Image Editor Demo allows to open TIFF image of unlimited size and edit TIFF image if image consists from tiles. Please try to use our Raster Grid Image Editor Demo and let me know if you will have any question or problem.

Best regards, Alexander
damian.tomas
Posts: 5
Joined: Tue Aug 22, 2017 10:28 am

Re: Big TIF image processing

Post by damian.tomas »

Hello Alexander,

thank you very much for your reply. I am able to open my TIFF image with Raster Grid Image Editor but I don't know how I can resize my image. Could you describe me the steps? I can only change cell image if I right click on the cell.

Thanks,
Damian
Alex
Site Admin
Posts: 2304
Joined: Thu Jul 10, 2008 2:21 pm

Re: Big TIF image processing

Post by Alex »

Please send me more info about your task:
  • What size does the source image have?
  • What compression does the source image have?
  • Is the source image divided into tiles? If yes, what is the size of tile?
  • Do you want to upscale or downscale the source image? What is the size of destination image?
Best regards, Alexander
damian.tomas
Posts: 5
Joined: Tue Aug 22, 2017 10:28 am

Re: Big TIF image processing

Post by damian.tomas »

- The source image has size of 4800 x 47820 pixels (3.16 MB). It is one-color image in this case but there will be also different images in the future so it is required to use NearestNeighbor interpolation (do not change number of colors).
- This image has LZW compression.
- Hmmm, I think this image is not divided into tiles.
- I would like to upscale the source image to the size of 7200 x 71730 pixels.

Thanks,
Damian
Alex
Site Admin
Posts: 2304
Joined: Thu Jul 10, 2008 2:21 pm

Re: Big TIF image processing

Post by Alex »

Hello Damian,

Thank you for information.

You need ~690Mb (4800*47820*3) for loading your source color image into memory. Most modern computers have necessary free memory for this operation.
You need ~1550Mb (7200*71730*3) for loading your source color image into memory. Not all computers have necessary free memory for this operation.

For resizing your image I can suggest you to do the following steps:
  1. Load source image into memory.
  2. Create new empty TIFF image with tiles and save it to a file. Please see how to do this in our Raster Grid Image Editor Demo.
  3. Divide source image into quadratical regions.
  4. For each source image region:
    1. Get the region image.
    2. Scale the region image.
    3. Add scaled region image as a tile of new TIFF file. Please see how to do this in our Raster Grid Image Editor Demo.
    4. Save changes in new TIFF file

Here are useful links:
Best regards, Alexander
damian.tomas
Posts: 5
Joined: Tue Aug 22, 2017 10:28 am

Re: Big TIF image processing

Post by damian.tomas »

Hello Alexander,

thank you very much for your help. I was able to do the whole process. Is it possible that this operation takes about 1 minute and 40 seconds? Should I check what takes the longest and try to decrease time?

Best regards,
Damian
Alex
Site Admin
Posts: 2304
Joined: Thu Jul 10, 2008 2:21 pm

Re: Big TIF image processing

Post by Alex »

Hello Damian,

Your process can be divided into several tasks:
  • Get image regions
  • Scale image regions
  • Write scaled image regions into TIFF file
Please check the performance of tasks and let me know results.

Best regards, Alexander
damian.tomas
Posts: 5
Joined: Tue Aug 22, 2017 10:28 am

Re: Big TIF image processing

Post by damian.tomas »

Hello Alexander,

I do these tasks in every loop iteration (for every tile). In my case I have 330 tiles.
This is summing up of my processing:

- Get image regions: 1 minute
- Scale image regions: 6,5 seconds
- Write scaled image regions into TIFF file: 29 seconds.

I've also noticed that for tile of size 7168 x 7168 (7*1024) everything works fine but for tile of size
8192 x 8192 (8*1024) I have an out of memory during new empty TIFF image creation.

Best regards,
Damian
Alex
Site Admin
Posts: 2304
Joined: Thu Jul 10, 2008 2:21 pm

Re: Big TIF image processing

Post by Alex »

Hello Damian,

Sorry for delay.

You have the performance issue and out of memore issue. We can help you to improve your application but for doing this we need reproduce your problems on our side. Could you provide us an application, which allows to reproduce your problems, for tests? If yes, please send your application with test data to support@vintasoft.com.

Best regards, Alexander
Post Reply