GFL New Source Conversion help. !! Working !!

Just starting out? Need help? Post your questions and find answers here.
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

GFL New Source Conversion help. !! Working !!

Post by Inner »

http://www.xnview.com

Is this the only freeware multi-format image loader/convertor/saver available or is there another, that supports more or less then 350 image formats?

I had an attempt at converting it, but I am no VB expert or any of the other languages it supports natively, like delphi, bcc, vc++ etc. the most I could port from the source code provided was a black image, I got all the other functions for infomation working, but when it comes to image display I am useless.

I can post my work if anyone wishes, to try futher.

[fustrated@self] - I don't know why PureBasic hasn't picked up this library already it would sovel imaging loading perminantly, and there wouldn't be any need for a plugin system like we have to day, because all formats are pretty much coverted, sure no one really needs 350 formats support out of those 350 only a few would be used maybe 10 or so, but it'd be nice. [/fustrated@self]
Last edited by Inner on Fri Jul 11, 2003 3:34 pm, edited 3 times in total.
LarsG
Enthusiast
Enthusiast
Posts: 713
Joined: Mon Jun 02, 2003 1:06 pm
Location: Norway
Contact:

Post by LarsG »

I guess a reason for it not being used is that this program is not free for commercial use.. it costs 27$ for a 1 workstation lisense...

AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

Post by Inner »

I guess that's a fare enough comment, except I am a freeware developer not a "expens'o'ware" developer.
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

I can recommend 'DevIL' which is really cool.
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

Post by Inner »

Er.. I guess that standards for Development Image Library :) --- ( I'm a Christian ) --- LOL . I'll take a look at it thanks Fred.

Just had a look, doesn't support nearly as many formats as xnview. :( keep in mind that beating or being equal to 350+ formats is pretty hard tasks to challange.

That and I don't feel comfortable with the name.
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Mouarf :twisted:
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

Post by Inner »

:evil: 8O :arrow: Stage Left == Run ======= :arrow:

:)

I may just have to bite the bullet and build a interface of some discription inbetween PB and GFL.
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

Irfan view is excellent, and supports batch conversions.

www.irfanview.com
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

Post by Inner »

Yes it is excellent but;

doesn't support 350 formats
doesn't have an SDK for developers as far as I know.
& would mean I'd have to use the RunProgram command, which is umm not an elagant way to implyment something. :cry:

[background]
I guess by now it would appear as thou I'm being picky, but cd databasing software needs a wide deepth of flexibilite to identify/display/convert & resize all sorts of media, the last email I want about my software is can you support x or y image format, worse still getting an email of abuse because I just added a format of some discription that wasn't there before, forcing an end user to recatalog an entire cd collection. [ yes the idea is to when scanning cd's to take thumb nails of ever image it comes accross, store that data, and recall it again without having to have the cd in the drive, if the bigger image is requested obviously the correct cd would have to be re-inserted. ] the converting part I heaverly cludged together with NConvert.exe and I dispise it entirely. because it slows the scanner down having to fire up a .exe just to perform a resize on a .neo image file, or any other format for that matter.

this is my current work : http://www.inet.net.nz/~tjr/irc/gfl-purebasic.rar

maybe someone could help with it. [ please ] pretty please, please with a cherry on top :)
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

Post by Inner »

It comes down to this last few problems;

Code: Select all

static void GetDIBFromBitmap( GFL_BITMAP *bitmap, LPBITMAPINFOHEADER * pbitmap_info, unsigned char **data )
{
	int i;
	int j;
	int bytes_per_line; 
	unsigned char *ptr_src;
	unsigned char *ptr_dst; 
	LPBITMAPINFOHEADER bitmap_info; 
	RGBQUAD *colormap; 

	*data = NULL; 
	*pbitmap_info = NULL; 

	bitmap_info = *pbitmap_info = calloc( 1, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD) ); 
	colormap = (unsigned char *)bitmap_info + sizeof(BITMAPINFOHEADER); 
		
	bitmap_info->biSize   = sizeof(BITMAPINFOHEADER); 
	bitmap_info->biWidth  = bitmap->Width; 
	bitmap_info->biHeight = bitmap->Height; 
	bitmap_info->biPlanes = 1; 
		
	if ( bitmap->Type == GFL_BINARY )
	{
		bytes_per_line = ((bitmap->Width + 31) / 32) * 4; 
		bitmap_info->biClrUsed = 2;
		bitmap_info->biBitCount = 1; 
	}
	else
		if ( bitmap->Type == GFL_GREY || bitmap->Type == GFL_COLORS )
		{
			bytes_per_line = (bitmap->Width + 3) & ~3; 
			bitmap_info->biClrUsed = 256;
			bitmap_info->biBitCount = 8; 
		}
		else
		{
			bytes_per_line = (bitmap->Width * 3 + 3) & ~3; 
			bitmap_info->biClrUsed = 0;
			bitmap_info->biBitCount = 24; 
		}

	bitmap_info->biCompression = BI_RGB; 
    bitmap_info->biSizeImage = bytes_per_line * bitmap->Height; 
    bitmap_info->biClrImportant = 0; 
		
	if ( bitmap_info->biClrUsed > 0 )
	{
		if ( bitmap->Type == GFL_BINARY )
		{
			colormap[0].rgbRed   = 0; 
		    colormap[0].rgbGreen = 0; 
			colormap[0].rgbBlue  = 0;

			colormap[0].rgbRed   = 255; 
			colormap[0].rgbGreen = 255; 
			colormap[0].rgbBlue  = 255;
		}
		else
		if ( bitmap->Type == GFL_GREY )
		{
			for ( i=0; i<bitmap->ColorUsed; i++ )
			{
				colormap[i].rgbRed   = (i * 255) / (bitmap->ColorUsed-1); 
				colormap[i].rgbGreen = colormap[i].rgbRed; 
				colormap[i].rgbBlue  = colormap[i].rgbRed; 
			}
		}
		else
		{
			for ( i=0; i<bitmap->ColorUsed; i++ )
			{
				colormap[i].rgbRed   = bitmap->ColorMap->Red[i]; 
				colormap[i].rgbGreen = bitmap->ColorMap->Green[i]; 
				colormap[i].rgbBlue  = bitmap->ColorMap->Blue[i]; 
			}
		}
	}
}
And this function;

Code: Select all

					
StretchDIBits( hDC, 0, 0, TheBitmap->Width, TheBitmap->Height, 0, 0, TheBitmap->Width, TheBitmap->Height, dib_data ? dib_data : TheBitmap->Data, (BITMAPINFO *)dib_info, DIB_RGB_COLORS, SRCCOPY ); 
I've no idea how to convert those, he is using strange symbols I've not see ever before in C, like ~,: And ?.
Saboteur
Enthusiast
Enthusiast
Posts: 273
Joined: Fri Apr 25, 2003 7:09 pm
Location: (Madrid) Spain
Contact:

Post by Saboteur »

~ = one's complement (same in PB)

Code: Select all

x ? a : b 
is equal to

Code: Select all

if x
  a
else
  b
endif
[:: PB Registered ::]

Win10 Intel core i5-3330 8GB RAM Nvidia GTX 1050Ti
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

Post by Inner »

Thanks Saboteur
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

Post by Inner »

New Source, and yes it doesn't work;

But it's closer :)

http://www.inet.net.nz/~tjr/irc/GFL_PB2.zip

includes the VB source
includes my pitaful atempt at porting it too.

But it kinda works if you like "Software Failure" :)

I feel completely useless, so anyone that whats to download the latest botch up, and mock me your more than welcome.
Doobrey
Enthusiast
Enthusiast
Posts: 218
Joined: Sat Apr 26, 2003 4:47 am
Location: Dullsville..population: me
Contact:

Post by Doobrey »

Inner wrote: I feel completely useless, so anyone that whats to download the latest botch up, and mock me your more than welcome.
Don`t give up Inner, it`s all part of the learning process. Sometimes you can get stuck for ages on a bit of code, but then somehow it all comes together.
Porting code from a language you have little knowledge of is never easy but once you get to know the way it works it becomes a bit easier.

I tried writing a winamp plugin using PB last year..it kept crashing after 2 secs, so I gave up..until yesterday, spotted that a procedure in my DLL should have been a ProcedureCDLL instead of ProcedureDLL (no idea why Winamp mixes the 2 types in one plugin!) and it works. That one f#@$ing line took me 3 or 4 evenings of bugtracking to figure out :x
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

Post by Inner »

That'd be because ProcedureCDLL is a new resent command ;)

It's alot diferent trying to convert a programming language when the only comments in the source are french!, which makes it twice as hard because your going off purely code and only code.

The problem here is I know what I am doing, it's just not doing it.. the old and very worn out road of, "it doesn't work, it should work acording to logic"
Post Reply