Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting bitmaps to JPG in PB

Status
Not open for further replies.

Leelu

Programmer
Jul 4, 2005
3
ZA
Hi there,

Im currently doing a bugtracking system in PB10. I need to be able to have users do a print screen & paste it into a OLE/picture control or something where it will be displayed and the details captured of the bug. When the record is saved, the screenshot needs to be saved in JPG format in a specific folder.

I've done everything but hav a problem converting the pictures, at the moment its saving it in a format that the pictre viewers can open them. :-(

Can anybody shed some light on the matter for me?I have no clue where to start.


Thanx a Mill!!
~Lehane
 
Sounds like you will need a third party control which can save graphics. How are you saving the images now? (even if it is in the wrong format). Do you have some example code?

Matt

"Nature forges everything on the anvil of time
 
Im quite new working with pictures in PB. I hav no idea what to do, my silly attempt was to grab the picture and save it adding the '.jpg' extention.

I realised that that does not convert the picture ;-)

Im still researching my options on convertion.
For now what i've done for a quick solution, is to have the app open paint and have them save it jpg format whereever on their pc's. Then from there copy it into a directory on the server with the error number as pic name.

Code:
Long 			ll_err
DateTime		ldt_today
Int			li_error, li_status
String 		ls_docpath, ls_docname[], ls_foto_dir, ls_file
String		ls_err_no = ''
Integer	 	i, li_cnt, li_rtn, li_filenum, li_filecopy
string  		pathname, filename, ls_ini_dir

ll_err = tab_error.tabpage_err_details.dw_err.getrow()

ls_err_no = string(tab_error.tabpage_err_details.dw_err.GetItemnumber(ll_err, 'err_no'))

ChangeDirectory(gs_current_dir)

ls_ini_dir = ProfileString('bugtracker.ini', 'IniFile', 'inifile', 'C:\')

ChangeDirectory(ls_ini_dir)

ls_foto_dir = ProfileString(gs_ini_file, 'bugtracker', 'Dir', 'C:\BugFotoDir')

IF DirectoryExists ( ls_foto_dir ) = FALSE THEN
	CreateDirectory ( ls_foto_dir )
ELSE
	ChangeDirectory ( ls_foto_dir )
END IF

ls_file = ls_foto_dir + '\' + ls_err_no + '.jpg'

Messagebox("Picture Format", "Please make sure that your error screenshot has been saved in JPG format before you select it!", Information!)

li_rtn = GetFileOpenName("Select the Error picture", &
    ls_docpath, ls_docname[], "JPG", &
    + "JPG Files (*.jpg),*.JPG" , "C:\") 

IF li_rtn < 1 THEN return

li_filecopy = FileCopy(ls_docpath, ls_file, TRUE)

sle_browse.text = ls_file
is_file = ls_file

IF Mid(ls_file, 1, 2) = '\\' Then ls_file = '\' + ls_file

//populate the path field in the table
tab_error.tabpage_err_details.dw_err.setitem(ll_err, 'path', ls_file)

CHOOSE CASE li_filecopy
	CASE 1
		// Success
		p_pic_display.picturename = String(ls_docpath)
	CASE -1
		MessageBox('Picture Error', 'Error opening sourcefile', StopSign!)
	CASE -2
		MessageBox('Picture Error', 'Error writing targetfile', StopSign!)
END CHOOSE

Thanks for your quick response!

Thanx a Mill!!
~Lehane
 
as mbalent said, you will need some "third-party"-utility to do the conversion.
from my own experience with pb8 i can't tell any pb-functions for that. i have heard about
freeimage in other forums, which provides multiple wrappers to image conversion...
maybe you should try that, simply adding an extension of course doesn't make the file a jpeg. [smarty]
 
Thank you Very much for the tip...I'll be sure to check it out!!

Thanx a Mill!!
~Lehane

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top