Creating and saving an image from sprite?

This forum is currently in read-only mode.
From the Asset Store
Match the similar cards with each other and free all animals!
  • Basically say i have two sprites, one is on top of the other, i want to make an image out of them together and save it, is it possible in construct? I know you can do it in the old mmf but not sure how to do it here?

    I haven't found any way to have two sprites merged together or to have an image created from a certain area, one of those two would be excellent to have!

  • You can paste sprites into a canvas object but you can't save to a file. Unless there's some other method for doing that.

  • Well i tried paste sprite into canvas, then image manipulator copies from canvas, then saves into a new image.

    Image is always blank.

  • Well i tried paste sprite into canvas, then image manipulator copies from canvas, then saves into a new image.

    Image is always blank.

    There needs to be time between pasting the object into the canvas, copying the canvas to the image manipulator, and then saving the image. So you could do something like this with the function object:

    1. +Stuff happens:
         -Canvas: Paste Sprite into Canvas
         -Function: Call  function "Copy" after 100ms.
    
    2. +On function "Copy"
         -ImageManipulator: Copy image from Canvas
         -Function: Call  function "Save" after 100ms.
    
    3. +On function "Save"
         -ImageManipulator: Save PNG image to "c:\stuff.png"
    [/code:16x2oi7e]
    I don't think the ImageManipulator is able to process the images as fast as is needed to copy from the canvas and then save the image all in one event, so this is necessary.  Hope that helps.
  • You where completely right, that is annoying heh.

  • Events aren't run while the GPU is drawing necessarily, so if you copy from a canvas directly after instructing it to draw, it won't have drawn yet, and you'll get a blank image.

  • Well it doesn't seem to work at all now, heres a shot of what i'm doing:

    <img src="http://i43.photobucket.com/albums/e397/clericvash/Clipboard02-4.gif">

  • The delay is needed after copying to canvas, not after copying to image manipulator.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ah ha thank you my man, you saved me dude.

  • Possibly a bug though:

    Canvas is sized 20x20 and a sprite is sized 20x20 no resizing done afterwards yet the canvas is largely bigger than the sprite?

  • The delay is needed after copying to canvas, not after copying to image manipulator.

    I could have sworn that didn't work for me when I last tried it, but I guess you're right.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)