Indigo Rose Software

Professional Software Development Tools

 
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 22

Thread: Image Resizing

  1. #1
    Join Date
    Sep 2005
    Location
    Arizona
    Posts
    77

    Image Resizing

    Hello All,

    I've looked around the forum and found Intrigued's project using ImageMagic to resize an image, but the EXE seems rather hefty (4.4 MB)

    Does anyone know of a a DLL or EXE (free or cheap) and a bit smaller with a command line function that will let me create a 100x100 thumbnail in AutoPlay? All I need is to resize the image... no cropping, etc.

    Anyone interested in writing a DLL?

    Any input is always appreciated!

    Steve Russell

  2. #2
    Join Date
    Mar 2006
    Location
    Corpus Christi, Texas
    Posts
    132
    I got this from the forum a while back (I think it was from Worm but not sure)
    Attached Files

  3. #3
    Join Date
    Apr 2004
    Location
    Vancouver, Canada
    Posts
    1,790
    Here is a small dll I created for my needs. Only returns a JPG but can accept BMP, PNG and JPG.

    Use it like this.
    Code:
    local SourceImage = "Full Path To Your Image" -- Can be BMP, PNG or JPG
    local Width = 100
    local Height = 100
    local SaveAs = "Full path and file name to save resized image as" -- Must have ".jpg" extension
    local Format = "JPG" -- Only JPG supported
    	
    local result = DLL.CallFunction(_SourceFolder.."\\AutoPlay\\Docs\\xImage.dll", "Convert_Image", "\""..SourceImage.."\",\""..SaveAs.."\",\""..Width.."\",\""..Height.."\",\""..Format.."\"", DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
    	
    if result == "OK" then
    	Dialog.Message("Done", "Image resized and saved as "..SaveAs)
    else
    	Dialog.Message("Error", result)
    end
    Last edited by Dermot; 11-14-2009 at 09:33 PM.
    Dermot

    I am so out of here

  4. #4
    Join Date
    Sep 2005
    Location
    Arizona
    Posts
    77
    A great thanks... I'll try both of these out!

  5. #5
    Join Date
    Sep 2005
    Location
    Arizona
    Posts
    77
    Dermot, that worked out perfectly... many thanks!

  6. #6
    Join Date
    Jun 2006
    Location
    UK SouthWest
    Posts
    420
    Here's a small command line program i wrote that outputs to BMP

    Picres is a picture resizer that accepts BMP,PNG,JPG,GIF,icon)
    Filesize 74kb

    The command line syntax is :
    Picres [SourceFile]#[TargetFile]#[Optional new width]#[Optional new height]
    Code:
    File.Run("AutoPlay\\Docs\\MyProg.exe","Pic.bmp#ResizedPic.bmp#200#200", "", SW_SHOWNORMAL, true);
    The program can be used as a simple 'to bmp' format coverter if the width and height are left out:
    Picres [SourceFile]#[TargetFile]
    Code:
    File.Run("AutoPlay\\Docs\\MyProg.exe","Pic.bmp#ResizedPic.bmp", "", SW_SHOWNORMAL, true);

  7. #7
    Join Date
    Feb 2005
    Location
    Birmingham, Alabama
    Posts
    175
    what about calling windows GDI32.DLL? Is it possible?

  8. #8
    Join Date
    Sep 2005
    Location
    Arizona
    Posts
    77
    Quote Originally Posted by thetford View Post
    what about calling windows GDI32.DLL? Is it possible?
    Haven't tried it myself, but might be possible? Right now I'm using Dermot's DLL, which works perfectly - thanks Dermot!

  9. #9
    Join Date
    Jun 2002
    Location
    Israel
    Posts
    1,843
    Question to Dermot:
    How can you keep the image proportions? Can the resize be done in percentage instead of pizels?
    Maybe by checking the original image size? Is there a way to do that?

    Thanks

    Yossi

  10. #10
    Join Date
    May 2006
    Posts
    5,380
    Can the resize be done in percentage instead of pizels?
    you can do that in AMS then pass the size to the dll, i have a function in a apz somewhere that divides a number into 100% subtracts or adds the required amount (in%) then returns the amended size based of the original size, just for things like this, but do you think i can find it.....no, i'll keep looking
    Open your eyes to Narcissism, Don't let her destroy your life!!

  11. #11
    Join Date
    Apr 2004
    Location
    Vancouver, Canada
    Posts
    1,790
    The dll will keep the image proportional so you don't have to worry about. As RizlaUK says, you should be able to use AMS to calculate percentages and come up with the new size and then pass that to the dll.
    Dermot

    I am so out of here

  12. #12
    Join Date
    Jun 2002
    Location
    Israel
    Posts
    1,843
    Sorry, I don't get it.
    Your code makes use of width and height:
    Code:
    local result = DLL.CallFunction(_SourceFolder.."\\AutoPlay\\Docs\\xImage.dll", "Convert_Image", "\""..SourceImage.."\",\""..SaveAs.."\",\""..Width.."\",\""..Height.."\",\""..Format.."\"", DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
    How can I keep proportion if I don't know what they are (image in landscape or portrait for example).
    Let's say I have a 640X 480 image. Choosing width=320 and height=240 will give me exactly 1/4 size image without distortion. But if I start with a 480X640 image (portrait) and set the same width (320) and height(240), the image will be distorted.

    What I want is a way to resize images to same size but keep proportions.

    Thank you

    Yossi

  13. #13
    Join Date
    Apr 2004
    Location
    Vancouver, Canada
    Posts
    1,790
    Quote Originally Posted by yosik View Post
    Sorry, I don't get it.
    Your code makes use of width and height:
    Code:
    local result = DLL.CallFunction(_SourceFolder.."\\AutoPlay\\Docs\\xImage.dll", "Convert_Image", "\""..SourceImage.."\",\""..SaveAs.."\",\""..Width.."\",\""..Height.."\",\""..Format.."\"", DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
    How can I keep proportion if I don't know what they are (image in landscape or portrait for example).
    Let's say I have a 640X 480 image. Choosing width=320 and height=240 will give me exactly 1/4 size image without distortion. But if I start with a 480X640 image (portrait) and set the same width (320) and height(240), the image will be distorted.

    What I want is a way to resize images to same size but keep proportions.

    Thank you

    Yossi
    It will resize the image as close to the speicfied size as possible without distorting. It will never distort. If you want to pass the correct width and height based on the original size then use this
    new_width = (new_height * old_width) / old_height
    or
    new_height = (old_height * new_width) / old_width
    Dermot

    I am so out of here

  14. #14
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Quote Originally Posted by Dermot View Post
    Here is a small dll I created for my needs. Only returns a JPG but can accept BMP, PNG and JPG.

    Use it like this.
    Code:
    local SourceImage = "Full Path To Your Image" -- Can be BMP, PNG or JPG
    local Width = 100
    local Height = 100
    local SaveAs = "Full path and file name to save resized image as" -- Must have ".jpg" extension
    local Format = "JPG" -- Only JPG supported
    	
    local result = DLL.CallFunction(_SourceFolder.."\\AutoPlay\\Docs\\xImage.dll", "Convert_Image", "\""..SourceImage.."\",\""..SaveAs.."\",\""..Width.."\",\""..Height.."\",\""..Format.."\"", DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
    	
    if result == "OK" then
    	Dialog.Message("Done", "Image resized and saved as "..SaveAs)
    else
    	Dialog.Message("Error", result)
    end
    Mirrored on amsuser.com, here:

    http://www.amsuser.com/ams/examples/...MS7-Dermot.zip

    Thanks Dermont.
    Intrigued

  15. #15
    Join Date
    Jun 2002
    Location
    Israel
    Posts
    1,843
    ok. It looks like I didn't explain myself correctly.

    I want to use your Dll to batch resize images from a directory. Some images are landscape, some portraits and not all are the same size, so I DON"T KNOW what the size of the images are.
    I want all of the images to be resized to a set value (either width or height) but without distorting them.
    I have been looking for a way to check an image size from a file, and THEN I could use your method. BUt I couldn't find it.

    I hope this is clearer.
    Thank you for trying to help.

    Yossi

    Edit:
    It just struck me. There is an Image.GetFileInfo action which I forgot existed. THIS will give me the necessary information I need.
    I think I got that baby licked. I will work on that tomorrow. Thank you all for now
    Last edited by yosik; 02-28-2008 at 02:19 PM.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. FreePlugin: Splash Image Transition Engine DLL
    By RizlaUK in forum AutoPlay Media Studio 6.0
    Replies: 43
    Last Post: 03-26-2008, 08:41 AM
  2. Using slideshow from Windows?
    By Jonas DK in forum AutoPlay Media Studio 6.0
    Replies: 9
    Last Post: 12-30-2006, 12:57 PM
  3. Switching pictures with forward/back buttons
    By ilandv in forum AutoPlay Media Studio 4.0
    Replies: 10
    Last Post: 08-08-2004, 04:51 PM
  4. Function: Resize & Center an Image
    By kpsmith in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 05-17-2004, 01:36 PM
  5. Making a Thumbnail Image Browser
    By Desmond in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 09-26-2003, 02:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts