473,399 Members | 3,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Image Manipulation (Watermarking, Resizing and Thumbnails)

Good morning everyone

I am currently doing quite a large project in VB6 and ACCESS for college,
for a Photographers company assignment. I am posting here to see if anyone
has any advice on what I might want to try to counter the problems I seem to
be facing...

The only area of the project I am struggling on is the graphical side.
Basically, I need to take in a load of large photographs, create a thumbnail
for each, create a preview size for each, and then watermark the preview
size. The thumbnail size and preview size images will later be uploaded to
the web server so customers can view them.

Currently I am using two different methods for the different tasks. For
resizing, including preview size and thumbnails I have been using FreeImage
which seems to work pretty well actually. It hasn't been easy to find (free)
watermarking .DLLs/modules/activeX controls though, and I am currently using
something I found on a forum, which basically takes two pictures boxes and
loops through each pixel and combines the two picture boxes creating the
watermark. It is very hit and miss.. but it is kind of the best thing I can
use right now.

What I was wondering is does anyone know of a good method of doing the tasks
I want without having to include more than one or two .DLLs or something
like a control that supports all these features. There are loads out there I
have found on Google, but being a student I can't afford the huge price
tags! Any suggestions or ideas would be welcome and thanks for your time.

Lenny Challis

FYI: Here is some examples of the code I am using/referencing to make my
own:

___________________
Watermarking
___________________
Option Explicit

' Return (A * clr1 + (255-A) * clr2)\256.
Private Function CombineColors(ByVal clr1 As OLE_COLOR, ByVal clr2 As
OLE_COLOR, ByVal A As Byte) As OLE_COLOR
Dim r1 As Long
Dim g1 As Long
Dim b1 As Long
Dim r2 As Long
Dim g2 As Long
Dim b2 As Long

b1 = Int(clr1 / 65536)
g1 = Int((clr1 - (65536 * b1)) / 256)
r1 = clr1 - ((b1 * 65536) + (g1 * 256))

b2 = Int(clr2 / 65536)
g2 = Int((clr2 - (65536 * b2)) / 256)
r2 = clr2 - ((b2 * 65536) + (g2 * 256))

r1 = (A * r1 + (255 - A) * r2) \ 256
g1 = (A * g1 + (255 - A) * g2) \ 256
b1 = (A * b1 + (255 - A) * b2) \ 256

CombineColors = r1 + 256 * g1 + 65536 * b1
End Function

Private Sub Command1_Click()

DrawWatermark Picture1, picBackground, (picBackground.ScaleWidth / 2 -
Picture1.ScaleWidth / 2), (picBackground.ScaleHeight / 2 -
Picture1.ScaleHeight / 2)

End Sub

' Copy the watermark image over the result image.
Private Sub DrawWatermark(ByVal wm_pic As PictureBox, ByVal bg_pic As
PictureBox, ByVal x As Integer, ByVal y As Integer)
Const ALPHA As Byte = 128
Dim transparent As OLE_COLOR
Dim wm_clr As OLE_COLOR
Dim bg_clr As OLE_COLOR
Dim new_clr As OLE_COLOR
Dim px As Integer
Dim py As Integer

' Get the transparent color.
transparent = wm_pic.Point(0, 0)

' Combine the images.
wm_pic.ScaleMode = vbPixels
bg_pic.ScaleMode = vbPixels
For py = 0 To wm_pic.ScaleHeight - 1
For px = 0 To wm_pic.ScaleWidth - 1
wm_clr = wm_pic.Point(px, py)
If wm_clr <> transparent Then
bg_clr = bg_pic.Point(x + px, y + py)
new_clr = CombineColors(wm_clr, bg_clr, ALPHA)
bg_pic.PSet (x + px, y + py), new_clr
End If
Next px
Next py
End Sub

Private Sub Form_Load()

End Sub
Jul 17 '05 #1
0 6830

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Christina | last post by:
How can my ASP serverscript read a JPG file and create a small thumbnail image? I don't mean simple resizing, but true resizing so that the image actually gets smaller in size. Is this possible...
14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
8
by: Chris Dewin | last post by:
Hi. I run a website for my band, and the other guys want an image gallery. I'm thinking it would be nice and easy, if we could just upload a jpg into a dir called "gallery/". When the client...
2
by: Thomas | last post by:
Hi all, I've written an image resizing class so that I can generate thumbnails and various image sizes on the fly. The problem I'm having is that on about 70% of the thumbnails I generate, I...
4
by: dgk | last post by:
I have an app that has many subdirectories containing one or more images (jpg, gif, bmp). When the user selects a directory, my plan is to show the images if there are only one or two, or show...
9
by: Fred | last post by:
Hello, I would like to dynamically add a text as a watermark on images. I managed to do that with aspsmartimage but as the watermark is added when the image is sent to the browser, it takes...
1
by: goldtech | last post by:
Is there a way to create thumnails with a script in PHP with safe mode ON? We want to keep safe mode ON for our server but beable to automatically create thumbs from full size image files. Is...
6
by: RoseW | last post by:
This is a collection of images with its own style sheet to create the hover over the thumbnail and the larger image appears. http://www4.webng.com/chesleyhs/images/planting/Planting.html Narrow...
10
by: mishrarajesh44 | last post by:
hii all, I am facing a problem currently.. i have a script for image uploading and resizing.. the image uploading takes place properly for every size images.. but, the resizing works for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.