+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 23
  1. #1
    Junior Member
    Join Date
    Aug 2001
    Location
    Jackson, NJ
    Posts
    17

    A challenge to u programmers

    I need a program that deals with bitmaps (.bmp)

    First, it has to get the size of the bitmap.

    Next, it calculates wether or not both the height and width are multiples of 16.

    If not, (for either the height or the width), the bitmap would be enlarged so that both the height and width are multiples of 16.

    If any enlargement takes place, the image must be streched to fill the new size.

    The program will have to do this all automatically, given a list of files (or perhaps a directory where the files are located)

    -----
    Can any of u out there do this?

  2. #2
    Banned qball's Avatar
    Join Date
    Oct 1999
    Location
    Rockaway, NJ 07866
    Posts
    1,730
    sure, but why bmps?

  3. #3
    Senior Member rh71's Avatar
    Join Date
    Oct 1999
    Location
    LI | NY
    Posts
    782
    This can be done thru the web, where the new resized image will appear in a web browser. My question is... is this a school project where you have to have the code in your possession? Or do you just want to see it done?
    Last edited by rh71; 09-18-2001 at 10:28 PM.

  4. #4
    Junior Member
    Join Date
    Aug 2001
    Location
    Jackson, NJ
    Posts
    17
    i make maps for counter-strike... and i wanted to make my own wad file. the images in the wad i saved all as bmp's. however, in order for them to work the sizes have to be multiples of 16. why? who knows, ask valve (they made half-life). prolly helps with aligning or is more efficient, i dunno.

  5. #5
    Junior Member
    Join Date
    Aug 2001
    Location
    Jackson, NJ
    Posts
    17
    The file sizes are all mixed up from various sources (i didnt actually draw them myself... i would have done the correct size from there...hehe).

    I've looked at several batch resizers... however non work exactly how i want... with both hieght and width a multiple of 16.

    If worst comes to worse.. ill resize them all with a program out there to be all the same size.

    Ideally... u make the program check the size and resize to the NEAREST multiple of 16 (for example, using "mod" in vb to get the remainder). this way, the image is least distorted.

    [This message has been edited by Ghost-Agent (edited 09-13-2001).]

  6. #6
    Member strangerstill's Avatar
    Join Date
    Sep 2001
    Location
    Oxford
    Posts
    203
    ohkaaay. bmps are such a simple file format that it wont take you too long to write a vb app that works with the raw bytes. eg in a 24-bit bmp bytes 0xC-0xF are the width, bytes 0x10-0x13 are the height (little-endian) & the pixels are 4-byte blue-green-red-00 (RGBQUAD) listed line-by-line starting at 0x30.
    So your app just needs to load in a RGBQUAD 2-d array, manipulate it however u want, & write back to disk. anti-aliasing could be trickier. Anyway, bitmaps are described at http://msdn.microsoft.com/library/en...tmaps_5jhv.asp

    oops, tell a lie: in a 24-bit bmp the pixels are 3-byte blocks BGR but all sit together until the end of each line, where you have enough 00s to bring the length of the line up to a multiple of 4. look at a bmp in your hex editor & see what i mean.

    [This message has been edited by strangerstill (edited 09-13-2001).]

  7. #7
    Banned qball's Avatar
    Join Date
    Oct 1999
    Location
    Rockaway, NJ 07866
    Posts
    1,730
    java, VB, C, whatever...

    I would create a command line java app that takes two parameters (so you can use it over again). First, directory where bmps exist, second, directory where to place resized files.

    Doing the modulus and determining what the new size will be is trivial:

    int width = image.getWidth();
    int newWidth = width + (16 - mod(width, 16));

    Or something like that, barring syntax and **** like that.

    What else do you need?

  8. #8
    Banned qball's Avatar
    Join Date
    Oct 1999
    Location
    Rockaway, NJ 07866
    Posts
    1,730
    yeah, yeah, use a web browser. That will be about as much fun as opening each image in paint and manually modifying size.

    Back to your reqs. You say open image, determine size, and adjust to mult of 16. Ok, what is the range of sizes of the existing bmps? Are some 12X16 and others 1234X987? Can we just save all files as 64X64 (or whatever)?

    How many files?

    Wish you had known the 'multiples of 16' when you saved 'em. They need to be that way because of the way the bmp is drawn on a given surface through video processing, or something like that.

    Have you tried some sort of batch conversion with an image editing app (Photoshop, PSP6, etc) so you can select and resize? I have PSP4 (ancient), and it will convert to a bunch of formats, but no size conversions.

    I would figure other people who make wads run into this problem, check those sites. You can try:
    http://download.cnet.com

    Search on "bmp resize". Some look promising.

    Other than that, should be pretty easy to write a little java app to accomplish this task.

  9. #9
    Senior Member rh71's Avatar
    Join Date
    Oct 1999
    Location
    LI | NY
    Posts
    782
    The web app idea would be perfect for someone who's looking to accomplish the resizing without having to have anything installed locally. Just plug it in and it'll spit out the result. That's what web apps can be good for. This particular suggestion would not have been made if the true intent of the challenge had been put forth initially.

    qball, I wish I was allowed to tell you where you can stick your underhanded comments about other people's ideas. It doesn't, and never has, helped anybody. You are not better than anybody else here. Stop acting like it.

  10. #10
    Junior Member
    Join Date
    Aug 2001
    Location
    Jackson, NJ
    Posts
    17
    well, a web app would do fine... as long as it could proccess many bmp's and save them automatically.

    i do appreciate the help tho, and qball, that is pretty much it. just so long as when the image is englarged, it is streched to fit the new size.

    i know u can use api's with vb that will do that (bit blitting or some such things). do u intend to make a program with these guidelines?

  11. #11
    Member strangerstill's Avatar
    Join Date
    Sep 2001
    Location
    Oxford
    Posts
    203
    in case ur still interested, ive dug out some old code & shaped it into a vb/a app that does just what u want, even anti-aliasing on 24-bit bitmaps

    no api stuff, just good old byte-level manipulation

    attached here, just knock off the .bin & import into vb/a.
    Attached Files

  12. #12
    Junior Member
    Join Date
    Aug 2001
    Location
    Jackson, NJ
    Posts
    17
    hey, thnx a lot.. ill see how it works soon as i can, much appreciated

  13. #13
    Banned qball's Avatar
    Join Date
    Oct 1999
    Location
    Rockaway, NJ 07866
    Posts
    1,730
    strangerstill,

    post code, not exe.

    [me]
    To accomplish this task, I would write my own program, but I'm stupid. The resize each image to nearest mult (16), makes this non-trivial. I can do this (in a scalable and extensible manner) rather easily, because I am stupid.
    [/me]

    Now, I don't need to resize bmps.

    But, if I did, on a recurring nature, I would write a program and use it over and over, as I have before.

    How long and how well are youse gonna be making Counter-Strike maps?

  14. #14
    Junior Member
    Join Date
    Aug 2001
    Location
    Jackson, NJ
    Posts
    17
    u can execute bas files.... i thought that was code....

    anyway, im gonna make cs maps for how even long i play cs, which will be awhile. and i make them pretty well to, i like to have realism, structure, and function in my levels...

  15. #15
    Member strangerstill's Avatar
    Join Date
    Sep 2001
    Location
    Oxford
    Posts
    203
    Hey, .bas is code. I had to rename it .bin because the new board style only lets you attach .gif, .jpg & .bin - it was way too big to include in my post.

    Anyway, far as I'm concerned, that was trivial - I already had the code to load & save .bmps, and transforms arent exactly difficult to write - well, unless you want them efficient and if I did I wouldnt be using vb..

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts







New Security Features Planned for Firefox 4
Another Laptop Theft Exposes 21K Patients' Data
Oracle Hits to Road to Pitch Data Center Plans
Microsoft Preps Array of Windows Patches
Microsoft Nears IE9 Beta With Final Preview
Simplified Analytics Improve CRM, BI Tools
Android Passes RIM as Top Mobile OS in 2Q
VMware Updates Hyperic System Management
File Monitoring Key to Enterprise Security
LinkedIn Snaps Up SaaS Player mSpoke