Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help with Paint Picture please

1 view
Skip to first unread message

Paul

unread,
Sep 6, 2004, 6:12:54 PM9/6/04
to
Hello

I am trying to write a small program for printing out DVD covers.

I can get the covers for standard DVD cases to print just fine however, I am
having problems with the slim type cases.

The slim cases have a 7mm spine instead of the normal 14mm spine.

The DVD cover is 273mm X 183 with a 14mm spine

I need to be able to reduce the centre spine to 7mm.

From browsing the net and reading the help file in vb6, I am sure I need to
use the clipping region of the PaintPicture but I just cannot figure out how
to piece this code together. ( I am probably on the wrong track knowing me
:-)

If anyone can give me some sample code, I would really appreciate it.

Thank you

Paul


Mike Williams

unread,
Sep 7, 2004, 6:32:17 AM9/7/04
to
"Paul" <pa...@nospam.co.uk> wrote in message
news:109450870...@doris.uk.clara.net...

> I am trying to write a small program for printing out DVD
> covers. I can get the covers for standard DVD cases to print
> just fine however, I am having problems with the slim type
> cases. The slim cases have a 7mm spine instead of the normal
> 14mm spine. The DVD cover is 273mm X 183 with a 14mm
> spine I need to be able to reduce the centre spine to 7mm.

I'm not entirely sure what you are doing. Are you scanning a cover from a
standard case (273mm x 183 mm according to your own measurements) and do you
want to then print that cover at two different sizes (one for large cases
and the other for small cases)? If so then why not just use the PaintPicture
Width12 and Height1 parameters to set the size:

Printer.ScaleMode = vbMillimeters
Printer.PaintPicture x, y, 273, 183 ' for the standard case
Printer.PaintPicture x, y, 266, 183 ' for the standard case

The problem with such a simple method however is that the "spline" part of
the printed picture will be almost the same size as the original, and so it
will "overlap" onto the front and back. An alternative would be to print the
picture using three separate PaintPicture statements. First print the "back"
portion of the entire image at a size equal to the equivalent part of the
original cover, then 7mm below that print the "front" portion of the entire
image at a size equal to equivalent part of the original cover, and then
print the "spline" portion of the image in between the two at a size that is
reduced from 14mm to 7mm. This would result in a single printed picture that
looks exactly like the original except that it is 7mm shorter overall and
the information that is on the original 14mm spline now fits into the centre
7mm portion. It takes a bit of fiddling with the parameters so that it will
work under all circumstances, but it can certainly be done. If that's what
you want then post again and I (or somebody else) will knock up some code
for you.

Otherwise, give us some more detail of *exactly* what you are starting off
with and *exactly* what you want to do with it.

Mike

Paul

unread,
Sep 7, 2004, 9:33:34 AM9/7/04
to
Hello Mike

I am trying to achieve exactly what you have said
You are perfectly correct, if I just reduce the overall size of the cover
then the splinr overlaps.

If you have the time, I would be very grateful if you could knock some code
together so I learn from it

Thank you very much

Paul

"Mike Williams" <Mi...@WhiskyAndCoke.com> wrote in message
news:chk31a$3bn$1...@newsg2.svr.pol.co.uk...

Mike Williams

unread,
Sep 7, 2004, 10:53:11 AM9/7/04
to
"Paul" <pa...@nospam.co.uk> wrote in message
news:109456393...@doris.uk.clara.net...

> I am trying to achieve exactly what you have said
> You are perfectly correct, if I just reduce the overall
> size of the cover then the splinr overlaps. If you have
> the time, I would be very grateful if you could knock
> some code together so I learn from it

No problem, but I'm going out soon and I may not be back for a few hours or
more, so it will be later tonight when I get around to it. In the meantime,
post again telling me *exactly* how you are scanning the original. I'm not
too bothered about the format (bitmap or jpeg) but I'd definitely like to
know whether you have cropped the image so that it contains the full image
of the unfolded cover and nothing else. In other words, if you have scanned
a full A4 page have you cropped the resultant image to get rid of any white
borders? Also, have you left it at the same orientation that is was when
scanned, so that if you open up the scanned image in a viewer you will see
it running lengthwise down the screen? I need *precise* details of what you
are starting with.

Mike


Paul

unread,
Sep 7, 2004, 11:04:29 AM9/7/04
to
Hello Mike

The image has been scanned and all the white areas have been cropped, so all
I am left with is a picture of the complete image.
The orientation is the same as the scan, which means that if you open up the
scanned image in a viewer, it shows the image in a landscape view.
I have carefully measured the original cover, and the dimensions are 273 x
183mm with a 14mm spine
The new cases I have bought appear to be the same size apart from the spine
which is 7mm
Thank you
Paul


"Mike Williams" <Mi...@WhiskyAndCoke.com> wrote in message

news:chki0h$oqh$1...@news6.svr.pol.co.uk...

Mike Williams

unread,
Sep 7, 2004, 11:45:18 AM9/7/04
to
"Paul" <pa...@nospam.co.uk> wrote in message
news:109456939...@doris.uk.clara.net...

> The orientation is the same as the scan, which means that if you
> open up the scanned image in a viewer, it shows the image in a
> landscape view.

Okay. Good job I asked because my scanner behaves differently at its default
settings, and I would have to rotate it to get what I think you have got.
Just to clarify the point, are you saying that the scanned and cropped
picture represents an area 273 mm wide and 183 mm high, and that if the
front cover shows (for example) a man standing up then he will appear
standing the right way up on the right side of the scanned picture? So that
the "back cover" is on the left of the scanned picture and the spline runs
vertically downwards roughly in the middle? If not then you're gonna have to
explain *exactly* what your scanned picture looks like.

Mike


Paul

unread,
Sep 7, 2004, 11:51:54 AM9/7/04
to
Hello Mike

Yest that is correct

The cropped image is 273 x 183 mm and the man would appear on the right ,
the spine in the middle and the left hand side would be the back cover

Paul


"Mike Williams" <Mi...@WhiskyAndCoke.com> wrote in message

news:chkl28$es3$1...@news5.svr.pol.co.uk...

Mike Williams

unread,
Sep 7, 2004, 4:11:16 PM9/7/04
to
"Paul" <pa...@nospam.co.uk> wrote in message
news:109457223...@doris.uk.clara.net...

> Hello Mike. Yes that is correct. The cropped image is 273 x
> 183 mm and the man would appear on the right, the spine in


> the middle and the left hand side would be the back cover

Sorry for the delay, Paul, but Maureen and I are going away in our "van"
tomorrow for a few days (a little motorhome) and we had to go out and stock
up of Budweiser and wine. It took three trips to the shops!

If what you have told me about your original image is correct then the
following code should do the job for you. It is a little bit more "long
winded" than you might expect because it needs to take account of the fact
that if the original is a bitmap then the "size" of the original scanned
image (as far as Windows is concerned) depends on both the scan resolution
and the computer's Windows "pixels per inch" setting, hence the "xRatio" and
"yRatio" stuff. Jpegs are a bit easier, because the "desired image size" is
built into the jpeg file data. Actually, the "desired size" is included in
many bitmap files as well, but Windows takes no notice of it! Anyway, the
code will handle both jpegs and bitmaps.

I've put some comments in the code so you can see how it works, but if you
need further explanation then post again (I'll be away for at least the next
few days though, so it'll be a while before I answer). Basically, it takes a
scan of a 273 x 138 DVD cover (with a 14mm spline) and prints it out as a
266 x 138 DVD cover with a 7mm spline that is a "compressed" copy of the
original 14mm one. It prints the output at the desired size whatever the
size of the original, so if you have a scanned original that needs to be
"cropped a bit smaller" to get rid of slight misalignments or ripped edges
then it should still work.

Mike

Private Sub Command1_Click()
Dim p1 As StdPicture
' These four constants represent the
' size of a "wide spline" original
Const face As Single = 129.5 ' width of back/front faces
Const oldspline As Single = 14
Const newspline As Single = 7
Const height As Single = 183
Dim oldwidth As Single
Dim picWide As Single, picHigh As Single
Dim xRatio As Single, yRatio As Single
Set p1 = LoadPicture("c:\Clint.bmp")
' The following two lines get the size in millimetres
' of the scanned image (which will vary with scan
' resolution and current Windows dots per inch setting
' if the image is a bitmap)
picWide = p1.Width / 100
picHigh = p1.height / 100
oldwidth = face * 2 + oldspline
xRatio = picWide / oldwidth
yRatio = picHigh / height
'Print oldwidth, xRatio, yRatio
'Exit Sub
Printer.ScaleMode = vbMillimeters
Printer.Orientation = vbPRORLandscape
Printer.Print ' always start a print job with this
' First print the back face
Printer.PaintPicture p1, 0, 0, face, height, _
0, 0, face * xRatio, height * yRatio, vbSrcCopy
' Now print the front spaced 7mm to the right of it
Printer.PaintPicture p1, face + newspline, 0, _
face, height, (face + oldspline) * xRatio, 0, _
face * xRatio, height * yRatio, vbSrcCopy
' Now print the original 14mm spline at a width of 7mm
Printer.PaintPicture p1, face, 0, _
newspline, height, (face * xRatio), 0, _
oldspline * xRatio, height * yRatio, vbSrcCopy
Printer.EndDoc
End Sub

Paul

unread,
Sep 10, 2004, 1:55:52 PM9/10/04
to
Hello Mike

Did you and Maureen manage to get away for a few days, where did you go to
?.

I have been working with the code you did for me, Thank you.

I have noticed that it is slow sending the output to th eprinter, I guess
this is because of all the calculations it has to do.

Paul


"Paul" <pa...@nospam.co.uk> wrote in message

news:109450870...@doris.uk.clara.net...

Mike Williams

unread,
Sep 16, 2004, 2:44:12 PM9/16/04
to
"Paul" <pa...@nospam.co.uk> wrote in message
news:109483886...@doris.uk.clara.net...

> Did you and Maureen manage to get away for a few days,
> where did you go to ?.

Certainly did. Went touring the South East of England. We might go again
(somewhere else, of course) in the next few days, but we're not sure yet.

> I have been working with the code you did for me, Thank you. I have
> noticed that it is slow sending the output to th eprinter,
> I guess this is because of all the calculations it has to do.

I've never actually timed the code, but I would imagine that it would be a
bit slower than printing (PaintPicture) a single image. This is because the
code actually uses PaintPicture three times in succession, each time
painting a "scaled" picture (actually a portion of the original). The
"calculations" themselves take no time at all, but the "scale the image"
that the PaintPicture function is called upon to do does take some time. If
you wish to speed it up a bit then use the StretchBlt API instead, but
whatever you do I'm afraid that scaling a picture will always take much more
time than printing it at its original size.

Still, you have to remember that this is a "one off" print job (unless of
course you're in some sort of production line!). I could help you with
"production line" stuff . . . . but I won't ;-)

Mike


0 new messages