My Latest "hack" Creation

  • limelier
    31st Jul 2011 Member 0 Permalink
    Gamax, you said you have one that uses the deco layer, could I have a copy of it if I don't save anything? (and from what I know it doesn't save it anyway)
  • danieagle7
    31st Jul 2011 Member 0 Permalink
    @DCBloodHound (View Post)
    Sorry, im spanish :D
  • Shriek
    31st Jul 2011 Banned 0 Permalink
    This post is hidden because the user is banned
  • limelier
    31st Jul 2011 Member 0 Permalink
    @Shriek (View Post)
    It can't recieve votes thus not reach top page.
  • BlueAmulet
    31st Jul 2011 Member 0 Permalink

    Deleted

    Edited once by BlueAmulet. Last: 12th Apr 2024
  • limelier
    31st Jul 2011 Member 0 Permalink
    I don't exactly know how to program. I just expected someone to have a script that can image plot.
  • Videogamer555
    31st Jul 2011 Member 0 Permalink
    @user25 (View Post)
    This is to answer your question User25, about how this works. However be prepared to read a Wall-O-Text as that's how long the explanation will take.

    It's actaully not a single program, more of a tool chain. I have a set of programs, each of which is important. My special program is only one of the programs I use. The technique works like this. ctrl+shift+mouse click to fill an empty playing field with an element (preferably something with a high palette index so it will be fairly bright in an image editor). Save it to a CPS file with Ctrl+savebutton. Run my program to un-BZIP2 the save data (now leave the program open as it has stored in memory the uncompressed file size and will be needed later to include in the header of the recompressed file). Use Gimp's raw image loader with the now uncompressed save data to find the start, width, and height of of the TPT image. This gives:
    offset=17136
    width=612
    height=376

    Then with that info written down in notepad, I don't need to go back to it ever again. Now to find a good palette. It should have 8 elements that are near to black, red, green, blue, cyan, magenta, yellow, white (with black of course being no element at all). Also best to pick elements that don't use extra variables to reduce the likelihood of glitching or even having TPT refuse to load it (and of course it's nice if you don't pick elements that require switching out of the default Fire Display in TPT in order to view correctly). Now draw them while zoomed in, one pixel after the next horizontally (leave one blank, and then put one pixel of each of the 7 remaining colors). Screen cap TPT window (Alt+PrtScr).and paste into a blank Photoshop document. Now crop around those 8 pixels and save as raw. Next save that TPT drawing you just made with those 8 pixels as a CPS file from within TPT. Again un-BZIP2 that with my program, and load it now into Photoshop using its raw image loader with the above offset, width, and height (could do it in Gimp but I prefer PS for my actual image processing, and using Gimp just as a raw image loader/offset finder for graphics ripping). The file you just created has the 8 palette colors. Now crop around the 8 pixels in this image and save it as raw. This file has the palette index numbers (thus element numbers) as used by TPT for the same colors that were in the previous file. Now you have 2 RAW files, one with palette colors, and one with palette index numbers. Next step is to use my other program I wrote. It creates a Photoshop palette file with the colors from the first of the 2 RAW files and assigns them the index number found in the second of the 2 RAW. You'll never have to create the palette again, as this can be reused.

    Now go to any picture you want and load it into Photoshop. Resize it to 612 by 376, and using the selection box, select only the 4 leftmost columns of pixels, and fill in as black (repeat for the 4 rightmost columns of pixels). Next convert it to "indexed color" mode. At the resulting dialog box, select custom palette from the drop down menu, and then in the custom palette box, go to the load button then select the palette you just created, and before clicking ok on the index color conversion dialog, make sure you select a dithering mode (preferably Diffusion, and in the "amount" box, put 100, for 100% diffusion). Then click ok here. Now immediately go back to the Color Table editor and select Grayscale from the dropdown menu and press ok, to convert the colors to their corresponding index numbers. The image will likely just look like noise with a hint of an image in it at this point, but that's ok as TPT will use these numbers for the colored elements to display the picture. Now convert it one more time, this time to Grayscale mode (to make sure the program knows we want to save a black and white image, not a color one). That last step was just to make sure it didn't somehow accidentally get saved as a color image, but may be unnecessary if Photoshop's raw image mode already works by saving index numbers and not colors for indexed color images.

    At this point you have the picture to use, but how do you reinsert it into the save file. First save the image as it is now as a raw image, and when it asks for offset use 17136 as found in an earlier step. This will pad the image with the correct number of 00 bytes. Now go to HxD hex editor and load both the uncompressed save file, and raw image file you just created. Go to the tab for the raw image file and do Ctrl+A and Ctrl+V to copy the entire image data including needed offset. Now go back to the tab containing the uncompressed TPT save that was made as a template for this very purpose and do Ctrl+B to paste it in and overwrite existing data there (Ctrl+V pastes it in but shoves the existing data farther along in the file to make room for the new data). Now save.

    Finally go back to the program I used to uncompress the data and now recompress. Now the output file should have a CPS file extension, and should contain the proper header, and should contin the once again BZIP2 compressed save data.

    Last step, Ctrl+mouse click the open file button in TPT and try to load the save. Pause it BEFORE loading as images made like this tend to self destruct. Now to clear any glitches go to the console and use these 2 commands:
    !set temp all 294
    !set life all 0

    If there's any signs that mysteriously appeared, delete them (though this shouldn't happen any more, as I fixed the most likely issue with my program that may have caused this glitch). Then Ctrl+mouse click the save button and save it under whatever name you want, now that it's glitch free.

    Now you've done it! You've converted a picture into a TPT simulation that actually looks like the original picture!


    Currently I'm working improved software that will do all the conversion process, not need a starting template CPS save file from TPT, and not need use of any external programs at all. It will have the TPT palette built into the program itself as resource data. However I'm running into glitch after glitch after glitch. My new program makes a save that will show correctly in the TPT's open file dialog's preview window, but refuses to load when you click the final load button. Also the uncompressed file size for the saves directly created from scratch in my new program are significantly smaller than the uncompressed size for a save containing the same exact configuration of elements when it's created in TPT iteslf. Same elements means same extra variables or same lack of extra variables (life, ctype, etc) and since picked C4 for my test which contains NO extra vars to make it simple, then the uncompressed save data (and also the compressed save data) should be EXACTLY identical, but it's not so I appear to be missing some variables (maybe introduced in a new ver of TPT?). My reference for variables in save files was this thread here https://powdertoy.co.uk/Discussions/Thread/View.html?Post=131518

    Any help with what I'm missing when I'm going by that thread's info alone, would be VERY VERY VERY VERY VERY MUCH APPRECIATED.
  • BlueAmulet
    31st Jul 2011 Member 0 Permalink

    Deleted

    Edited once by BlueAmulet. Last: 12th Apr 2024
  • Sylvi
    31st Jul 2011 Moderator 0 Permalink
    Doesn't matter this is not allowed. Image plotting rule is to protect the place from spam.
Locked by Lockheedmartin: No plotting.