Create report of images that need to be resized (1 Viewer)

mresann

Registered User.
Local time
Yesterday, 23:51
Joined
Jan 11, 2005
Messages
357
This is a problem I've been wrangling with for over two weeks. I have very high resolution images that I need to import into a Microsoft Access Report. The dataset (query) source for the report contains the following information:

Field Datatype Description
ImageID Text Unique ID image no. (Primary Key; use for sort asc)
ImagePath Text Full path to the hi-res image
SourcePixelWidth Long NumberPixel width of source image
SourcePixelHeight Long NumberPixel height of source image
TargetPixelWidth Long NumberPixel width of target image
TargetPixelHeightLong NumberPixel heightof target image

The process will only need to convert seven sets of sizes (all at 96 DPI), as follows:

Image TypeSource Pixel SizeTarget Pixel Size
15408 x 3216487 x 289
24328 x 2944390 x 265
34872 x 2944438 x 265
44600 x 3216414 x 289
55136 x 2944462 x 265
64600 x 2944414 x 265
74328 x 3216390 x 289

The image types correspond to days of week (Sunday, Monday, Tuesday, etc), and will repeat on down the report. There should be exactly three images on each page with a reasonable separation of space between them, centered on the pages horizontally. I am not worried about the size of the database file as everything will be created for local use, and I have enough local storage.

For some reason, this shouldn't be that difficult for me to do, and I feel that I'm missing something. I've used the Detail and Format section of the report but still not getting a result, particularly in my TWIP/pixel conversions most likely. I can post my (currently non-working) DB if it helps.

(For what it's worth, I cannot reduce the size of the images without losing acceptable quality with any of my programs like Photoshop or image applications, which frankly was my first option as I could easily import images already sized for the report.)
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:51
Joined
Oct 29, 2018
Messages
21,454
Hi. I'm not sure I understand what the problem is exactly. Can you elaborate further please? Thank you.
 

mresann

Registered User.
Local time
Yesterday, 23:51
Joined
Jan 11, 2005
Messages
357
Hi. I'm not sure I understand what the problem is exactly. Can you elaborate further please? Thank you.
I have a folder of 366 high resolution images that I want to put on a report, of which there are 366 records in my report source query that correspond to each one of those images. The images are similar to crossword puzzles, to be honest, but they are of differing sizes (seven different sizes as in OP). My report query source consists of the fields I indicated in the OP. The image sizes need to be dynamically created to those of the target size in the field, according to the image ID. (I know that source sizes wouldn't be used, but I included the fields as references).
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:51
Joined
Oct 29, 2018
Messages
21,454
Hi. Thanks for the additional information. Unfortunately, I'm not quite with you yet. Are you trying to resize an image file in a folder and end up with a duplicate image file at the reduced size?
 

mresann

Registered User.
Local time
Yesterday, 23:51
Joined
Jan 11, 2005
Messages
357
Hi. Thanks for the additional information. Unfortunately, I'm not quite with you yet. Are you trying to resize an image file in a folder and end up with a duplicate image file at the reduced size?
Exactly. I have to dynamically create the image (control) size that corresponds to the size in the Target width/height fields according to the image record.

I cannot just use a "zoom" or other image method as these are crossword-like puzzles, and don't want different sizes of squares that would occur if I just had one size of image container, so I would imaging the Format procedure in the Detail event would be similar to this:

Code:
   Me![imgPuzzle].Picture = cstrImageFolder & Me![ImagePath]
   Me![imgPuzzle].Width = Me![txtTargetPixelWidth]
   Me![imgPuzzle].Height = Me![txtTargetPixelHeight]

Field ImagePath is the full path to the hi-res image that will be used for the report.

(NOTE: txtTargetPixelWidth countrol source is field TargetPixelWidth, txtTargetPixelHeight control source is TargetPixelHeight)

NOTE that the "code" above doesn't work; I know that there is some conversion that needs to be done to convert pixels to twips including factoring in the DPI (96 DPI), but I've tried several different factors with no luck, and all I get are blank pages.

One more thing: If this helps, the actual size reduction of the images is that I need exactly 9% of the original size in all types, if that helps as well. For instance, 9% of a hi-res image of size 5408 x 3216 = 487 x 289 (nearest pixel), and the same ratio applies to all image types.
 
Last edited:

mresann

Registered User.
Local time
Yesterday, 23:51
Joined
Jan 11, 2005
Messages
357
:) Thanks for the help. Without the extra details, let me simplify the process to bare facts:

1. Create a report of images with information derived from query.
2. All images in query correspond to an image in a folder.
3. All the images in the folder are high-resolution.
4. Report code should change image control size that corresponds to the size located in the database for the current record corresponding to the image ID (in pixels; I know I need TWIPS but unsure of calculation).
5. Report should import image into the image control at its dynamically created control size in step 4.
6. Rinse / repeat for all images in recordset.

This is as simple as I can make it.

NOW, for the Image Resize function by Geoff Griffith: It looks promising, in that the image it creates for me looks to be ok in quality, but I'll need to convert more images. If this works, I can just pre-size the images, then I probably can use the same report that I had used previously when I didn't need to change the size of the images. I'll keep you posted as this solution would work. Thanks for your help, theDBguy!

NOTE: Give me some time before putting "Solved" in the title. Crossword puzzle images are very picky with quality that normal images don't have problems with on rendering, and need to make sure the images will work.

EDIT: NOT WORKING. The images created have unacceptable image quality. So let me rethink how to ask the question. In fact, I'll create a sample accdb file and include hi-resolution images and post later on. Thanks.
 
Last edited:

isladogs

MVP / VIP
Local time
Today, 07:51
Joined
Jan 14, 2017
Messages
18,209
This has now been crossposted at UtterAccess.com

For info (taken from my article Move Forms & Controls - Mendip Data Systems)
The position of objects in the Access window is determined in twips (one twentieth of imperial point size) where 1440 twips = 1 inch or 567 twips = 1 cm

However, the position of the mouse cursor is measured in pixels with reference to the overall screen: 1 pixel (px) = 15 twips so 96px = 1440 twips = 1 inch

Also, font size is measured in points (pt) where 1 point = 20 twips
A 72 point font = 1 inch = 1440 twips = 96px ;
Similarlly 12pt = 16px = 240 twips = 1/6 inch, 3 points = 60 twips = 4 px etc
 

mresann

Registered User.
Local time
Yesterday, 23:51
Joined
Jan 11, 2005
Messages
357
Thanks for the twips info. I have the same information. I apologize about the crossposting, but to be honest, I thought that this was going to be a bit easier than what is turning out to be. I'll have to farm this out to someone to create. Many thanks to all who tried to help.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:51
Joined
Oct 29, 2018
Messages
21,454
Thanks for the twips info. I have the same information. I apologize about the crossposting, but to be honest, I thought that this was going to be a bit easier than what is turning out to be. I'll have to farm this out to someone to create. Many thanks to all who tried to help.
Are you still planning to post a sample db? Just wondering...
 

mresann

Registered User.
Local time
Yesterday, 23:51
Joined
Jan 11, 2005
Messages
357
I'm preparing it, but I've gotten word that this may require more than what access is capable of internally. But give me a couple hours. Thanks.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:51
Joined
May 7, 2009
Messages
19,232
you should have a "uniform" size for you image, so you don't need
to use VBA (which apparently you have no knowledge and most of
us here on manipulating image files).
 

mresann

Registered User.
Local time
Yesterday, 23:51
Joined
Jan 11, 2005
Messages
357
OK, I've manually created the same dimensions for all images, so I don't have to calculate control size for the images. But I have another problem (image quality) which I will have to address in another way, and beyond the scope of the original post. Sorry there is no resolution here, and thanks to everyone who helped, particularly theDBguy.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:51
Joined
Oct 29, 2018
Messages
21,454
OK, I've manually created the same dimensions for all images, so I don't have to calculate control size for the images. But I have another problem (image quality) which I will have to address in another way, and beyond the scope of the original post. Sorry there is no resolution here, and thanks to everyone who helped, particularly theDBguy.
Hi. Good luck with your project. I was still waiting for your sample file, just in case it sparks any idea. So, feel free to still post it, if you want. Cheers!
 

mresann

Registered User.
Local time
Yesterday, 23:51
Joined
Jan 11, 2005
Messages
357
Not really sure what to post. Basically, I want to import monster-sized images into my report, as the images would have to be resized to 9% exactly of their actual dimensions. The problem is that if I pre-downsize the images to the proper size, the quality goes bad, but if I try to import them current size and let Access handle the reduction issues, then the report doesn't load the images (probably an internal time-out issue related to load time). So I had to go another route. The images are like crossword puzzles, so had some problems with "sharpness" issue. I can't have fuzzy puzzles.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:51
Joined
Oct 29, 2018
Messages
21,454
...but if I try to import them current size and let Access handle the reduction issues, then the report doesn't load the images (probably an internal time-out issue related to load time).
Hi. All along, I couldn't really grasp what the actual problem was. You kept saying you needed to resize the images, and I couldn't understand the reason why. If you had posted a demo sooner, I would have tried to run it, and probably see what you just said happen. So, the above piece of information was the missing piece for me to understand the reason why you needed to resize the images.

So, the next question then is to see how we can make the quality of the resized images better. What you could do for us right now is perhaps post a copy of one of your largest images, including a copy of the resized version of it, so we can see what a "bad quality" image to you means. We could then try to see if we have any tools to resize the images without sacrificing the quality. Also, could you please tell us which tool you are using to resize the images? Thanks.
 

Users who are viewing this thread

Top Bottom