Jump to content

Modifying and Saving an image


Recommended Posts

Hi all!

Hope you follow what I'm writing here...

As per title, I have an image (.bmp) and want to alter it -- add some text in a couple of places.

This is for a roll-out of 1,000 PCs, and I want to try and do this silently.

It's basically the CTRL-ALT-DEL screen:

On this we display the XP image version, Novell Client version, Zenworks version and PC name.

There is a basic background image with no text.

In the past this has been done with autoit :) :

- systems to log in as a special user

- BlockInput

- GUI with background image

- Text written from reg checks

- Then use the screen capture dll for the GUI.

However, I would like to do this without having to use the autoadminlogin feature of Windows.

I can use the same method with the screen cap (which is very quick) with a regular logged in user, but do run the risk that the user might have a window pop up right at the screen cap time. If I do a screen capture with the GUI off the screen, then only black is captures (there is no screen!).

There is also the possibilty that the machine isn't logged in for several weeks, leaving the information on the login screen out of date.

If I run it in a separate environment (System for example) then I get black again as there is no screen to capture, once more.

Preferably I would like to do this silently, without Windows being logged in (using Zenworks we can do lights out installs as System)...

But does anyone have any suggestions? I have seen references to Irfanview, but is there no way for autoit to accomplish this, perhaps with the help of a few DLLs?

Thanks for reading, and thanks for any replies!

Please correct me if I am wrong in any of my posts. I like learning from my mistakes too.

Link to comment
Share on other sites

Hi all!

Hope you follow what I'm writing here...

As per title, I have an image (.bmp) and want to alter it -- add some text in a couple of places.

This is for a roll-out of 1,000 PCs, and I want to try and do this silently.

It's basically the CTRL-ALT-DEL screen:

On this we display the XP image version, Novell Client version, Zenworks version and PC name.

There is a basic background image with no text.

In the past this has been done with autoit :) :

- systems to log in as a special user

- BlockInput

- GUI with background image

- Text written from reg checks

- Then use the screen capture dll for the GUI.

However, I would like to do this without having to use the autoadminlogin feature of Windows.

I can use the same method with the screen cap (which is very quick) with a regular logged in user, but do run the risk that the user might have a window pop up right at the screen cap time. If I do a screen capture with the GUI off the screen, then only black is captures (there is no screen!).

There is also the possibilty that the machine isn't logged in for several weeks, leaving the information on the login screen out of date.

If I run it in a separate environment (System for example) then I get black again as there is no screen to capture, once more.

Preferably I would like to do this silently, without Windows being logged in (using Zenworks we can do lights out installs as System)...

But does anyone have any suggestions? I have seen references to Irfanview, but is there no way for autoit to accomplish this, perhaps with the help of a few DLLs?

Thanks for reading, and thanks for any replies!

You can do this with Auto3Lib in pure AutoIt code. Take a look at the Emboss.au3 script in the Auto3Lib GDI+ folder. It captures the current screen, saves it to a file, loads the file back in, "embosses" text onto the image and then saves it back to file. You can just skip the screen capture part and load your bitmap directly. The Auto3Lib GDI module also allows you to draw on the image (circles, arcs, boxes, etc.) too and you can do some nice effects with the transparency settings to. If you want to give it a whirl and get stuck, feel free to PM me and I'll help you out with the code.
Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

Re your comments on this topic: http://www.autoitscript.com/forum/index.php?showtopic=47331

I was wondering if you might have some advice!

I am going to update te topic too, so that anybody else checking can see the answer (if there is one).

I am basically using the emboss.au3 to modify an image.

It works great with JPG! The text is there on the newly saved image.

However, if I try with BMP (open BMP original image, "emboss" and save BMP), then the newly saved BMP is exactly the same as the original -- there is no text on it.

The JPG is not good enough quality, so we need to use BMP (or TIF).

I tried to modify the script a little, taking information from BMPToJPG.au3, but each time I save the text is not there -- it successfully converts the IMAGE, but just doesn't apply the text.

Can you give any hints on that problem?

Thanks for the libraries tho' -- fantastic!

Please correct me if I am wrong in any of my posts. I like learning from my mistakes too.

Link to comment
Share on other sites

Wow.

I managed to stumble on a fix... not sure if this was docuemented and I missed it somewhere.

The emboss.au3 file uses JPG throughout. I changed all instances to BMP, and it STILL managed to emboss successfully.

However, when I changed the original file (no screeny) to my own BMP, it failed (with no error).

After checking the properties and differences between the screenshot BMP and my one, I found that

Screeny: 96x96DPI, 24-Bit

My BMP: 72x72DPI, 8-Bit

So I modified MY BMP in photoshop, and converted to the same (96DPI x 24-Bit).

After trying the emboss script once more with my (new) BMP, it worked fine!!!

So there is an issue with converting certain resolution images, but this workaround is fine for my purposes.

Thanks!

Please correct me if I am wrong in any of my posts. I like learning from my mistakes too.

Link to comment
Share on other sites

Wow.

I managed to stumble on a fix... not sure if this was docuemented and I missed it somewhere.

The emboss.au3 file uses JPG throughout. I changed all instances to BMP, and it STILL managed to emboss successfully.

However, when I changed the original file (no screeny) to my own BMP, it failed (with no error).

After checking the properties and differences between the screenshot BMP and my one, I found that

Screeny: 96x96DPI, 24-Bit

My BMP: 72x72DPI, 8-Bit

So I modified MY BMP in photoshop, and converted to the same (96DPI x 24-Bit).

After trying the emboss script once more with my (new) BMP, it worked fine!!!

So there is an issue with converting certain resolution images, but this workaround is fine for my purposes.

Thanks!

First, God bless you for sticking with the problem and finding a solution! I wish more people had that type of attitude when it comes to writing code. :rolleyes:

The Emboss demo works from a screen shot, so it knows that the bitmap that it will receive is 24 bit. However, you can load a bitmap from file and convert it to 24 bit using the GDI+ functions in Auto3Lib. If you look in A3LScreenCap at _ScreenCap_SetBMPFormat, you'll see that it is used to change the bpi of the screen capture for BMP files. You can take this code and automatically convert you incoming BMP file to 24 bit and then use Emboss to write on it.

If you get stuck and need a hand, drop me a line in the Auto3Lib thread or PM me.

Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...