Title: Making monochrome images Post by: Unseen Machine on April 27, 2011, 08:49:53 am Converted from the GDK function GDK_ApplyMonoFilter, this version can be used on any image.
Code: SCREEN _NEWIMAGE(800, 600, 32) image& = _LOADIMAGE("qblogo.png") ConvertImage_Mono image&, _RGB(0, 0, 0) _PUTIMAGE (0, 0), image& SUB ConvertImage_Mono (Image AS LONG, Alpha&) OldSource& = _SOURCE _SOURCE Image _DEST Image w% = _WIDTH(Image) h% = _HEIGHT(Image) FOR i% = 0 TO w% FOR j% = 0 TO h% m& = POINT(i%, j%) IF m& <> Alpha& THEN clrsum% = (INT((_BLUE(m&) / 100) * 11) + INT((_RED(m&) / 100) * 39) + INT((_GREEN(m&) / 100) * 50)) IF clrsum% > 0 AND clrsum% < 255 THEN PSET (i%, j%), _RGB(clrsum%, clrsum%, clrsum%) END IF END IF NEXT NEXT _SOURCE OldSource& _DEST 0 END SUB Title: Re: Making monochrome images Post by: OlDosLover on April 27, 2011, 08:58:31 am Hi all,
Welcome to the forum unseen. This looks a good program , thanks for sharing. Would like to point out that this site has Private Messageing and Image posting , and would like to invite you to use either as needed. OlDosLover. Title: Re: Making monochrome images Post by: OlDosLover on April 27, 2011, 09:27:23 am Hi all,
Inspired by unseen's post a little effect that tricks my eyes. Code: REM Thanks unseen.SCREEN _NEWIMAGE(800, 600, 32) image& = _LOADIMAGE("qblogo.png") effect& = _LOADIMAGE("qblogo.png") ConvertImage_Mono image&, _RGB(0, 0, 0) x% = 0: y% = 0: z% = 50 DO _LIMIT 30 _PUTIMAGE (0, 0), image& _PUTIMAGE (x%, y%)-(x% + z%, y% + z%), effect&, 0, (x%, y%)-(x% + z%, y% + z%) _DISPLAY x% = x% + 1: IF x% >= 158 - z% THEN x% = 0 y% = y% + 1: IF y% >= 127 - z% THEN y% = 0 LOOP UNTIL _KEYDOWN(27) SLEEP SYSTEM SUB ConvertImage_Mono (Image AS LONG, Alpha&) OldSource& = _SOURCE _SOURCE Image _DEST Image w% = _WIDTH(Image) h% = _HEIGHT(Image) FOR i% = 0 TO w% FOR j% = 0 TO h% m& = POINT(i%, j%) IF m& <> Alpha& THEN clrsum% = (INT((_BLUE(m&) / 100) * 11) + INT((_RED(m&) / 100) * 39) + INT((_GREEN(m&) / 100) * 50)) IF clrsum% > 0 AND clrsum% < 255 THEN PSET (i%, j%), _RGB(clrsum%, clrsum%, clrsum%) END IF END IF NEXT NEXT _SOURCE OldSource& _DEST 0 END SUB OlDosLover. Title: Re: Making monochrome images Post by: Unseen Machine on April 27, 2011, 10:05:53 am Nice, i never even thought of that!
Title: Re: Making monochrome images Post by: GarrisonRicketson on April 27, 2011, 07:53:39 pm Hi, Unseen, thanks for all the stuff you posted, I didnt reply to each one, But do appreciate them all,.. All though everyone here probably has the qblogo image, partly just to demo this, anyone that wants to run the above code, needs the attached image, or they can change the image file name in the code, for any image,..( I think, or dose the size matter, if so it ,the image,would need edited to the corect size, or the code),... any way here is the image attcahed. |