I am wondering if I can change the size of a picture before saving inside hmg.
Because I can not use TESTCAM anymore because of closing of activex I am using Microsoft camera and working good.
My customer has 10 microsoft tablets and the inside webcam only has 1 size setting. It makes 2249 k where the hmg camera makes 201.
Each invoice in the program I made for him uses 24 pictures and when he try`s to email the pdf is to big. Also his hard drive will fill up.
If I reduce thee size of the jpg to 200 to 300k everything would be perfect.
Change the size of jpg
Moderator: Rathinagiri
Change the size of jpg
All The Best,
Franco
Canada
Franco
Canada
Re: Change the size of jpg
Francofranco wrote: ↑Thu Jan 21, 2021 3:29 am
I need to take pictures with the camera of a Microsoft go 2 tablet.
The electric motor rewind technicians use the tablets to take pictures of different parts of motors while they rebuild.
They just want to hold tablet and take picture nothing else.
I am waiting for sample picture to post to see if a member (Andy) could show me how to resize with a function inside my program after taking picture.
Si tienes WORD, puedes crear un documento en blanco y en el insertar tus fotos, das doble click en cada una de ellas y cambias la calidad con las opciones que el WORD te muestra.
Después, guardas ese documento como PDF y lo envías.
*-----------------------------------------------------------------------------------------------------
If you have WORD, you can create a blank document and when you insert your photos, double click on each one and change the quality with the options that the WORD shows you.
Then you save that document as a PDF and send it.
Andrés González López
Desde Guadalajara, Jalisco. México.
Desde Guadalajara, Jalisco. México.
Re: Change the size of jpg
Holy Cow and WOW,
Thanks to
Andres, Jimmy an Mol
I have this working in a small program. I have shrunk a 3.2mg picture to 652kb. and it is 100% clear for what I need.
I used Mol`s suggestion designed by Jimmy
Amazing and thanks again.
Thanks to
Andres, Jimmy an Mol
I have this working in a small program. I have shrunk a 3.2mg picture to 652kb. and it is 100% clear for what I need.
I used Mol`s suggestion designed by Jimmy
Amazing and thanks again.
All The Best,
Franco
Canada
Franco
Canada
Re: Change the size of jpg
I need to check the size of the jpg file before sizing
This works for large files but small file get distorted.
hBitmap := BT_BitmapCaptureClientArea ("WinCam", 30,250, 360,360 ) //Row, Col, Width, Height)
BT_BitmapSaveFile (hBitmap, wname, .7)
BT_BitmapRelease (hBitmap)
I need to check file size first I do not know how to check jpg size ... like
if wname size > 800 kb
resize
endif
This works for large files but small file get distorted.
hBitmap := BT_BitmapCaptureClientArea ("WinCam", 30,250, 360,360 ) //Row, Col, Width, Height)
BT_BitmapSaveFile (hBitmap, wname, .7)
BT_BitmapRelease (hBitmap)
I need to check file size first I do not know how to check jpg size ... like
if wname size > 800 kb
resize
endif
All The Best,
Franco
Canada
Franco
Canada
Re: Change the size of jpg
I'm not sure, which .h files to include, so I've added all
Code: Select all
aSizeOfPicture := HB_GETIMAGESIZE( cFile)
#pragma BEGINDUMP
#include "HMG_UNICODE.h"
#include "SET_COMPILE_HMG_UNICODE.ch"
#include <hbapi.h>
#include "hbapifs.h"
#include <winsock2.h>
#include <iphlpapi.h>
#include <icmpapi.h>
#include <windows.h>
#include <commctrl.h>
#include "tchar.h"
#include "hbapi.h"
#include "hbapiitm.h"
#include "winreg.h"
#include <wingdi.h>
#include <winuser.h>
HB_FUNC( HB_GETIMAGESIZE )
/*
Syntax: HB_GETIMAGESIZE( cPicFile )
Parameter: cPicFile = graphic file (JPG, GIF, PNG)
Return: 2 dim array -> array[1] = width, array[2] == height
*/
{
int x = 0, y = 0;
GetImageSize( hb_parcx( 1 ), &x, &y );
hb_reta( 2 );
hb_storvni( x, -1, 1 );
hb_storvni( y, -1, 2 );
}
#pragma ENDDUMP
Re: Change the size of jpg
Sorry, I didn't read your request carefully.
You simply want to know size of a file, so use aDir function
You simply want to know size of a file, so use aDir function
Re: Change the size of jpg
Thanks Mol,
I think I got it
I think I got it
Code: Select all
if fileSize(wname)/1000 > 800
hBitmap := BT_BitmapCaptureClientArea ("WinCam", 30,250, 360,360 ) //Row, Col, Width, Height)
BT_BitmapSaveFile (hBitmap, wname, .7)
BT_BitmapRelease (hBitmap)
endif
All The Best,
Franco
Canada
Franco
Canada