+ update 2020: WARNING - support of the decompiler is now VERY LIMITED. There are no active developers. This means we will NOT develop new features and/or fix most of bugs. We left the tracker running in case somebody from community would like to work on it. Sorry for the inconvenience.
State: closed new: Initial state. As long as issue is in this state, the work on the issue has not yet begun. opened: Opened state means developer started working on the issue. Feature/Fix will probably be in the next release. postponed: This means developer is not working on it now, for some reason it cannot be implemented now. Issue may be opened again in the future. upgraded: Issue is in upgraded state when developer made changes to the program and new version was released. closed: This means the user is satisfied with issue results and no more changes are needed. invalid: These issues cannot be solved. ignored: Developer decided to take no action on this issue. returned: Program changes were made but user is not satisfied and returned the issue.
This is related to #984 but they are technically feature request and not bugs. My
descriptions here are in reference to the latest stable build (6.0.1)
- When a shape is replaced with an image, the program stretch or shrink the image to fit
inside the existing dimensions of the shape. It would be very helpful to have an option
during the replacement operation to either stretch/shrink the image to the shape, or
stretch the shape to fit the new image.
The current default is very good for replacing textures with high-res versions without
having to worry about potentially breaking shape arrangements. However when an image with
a different aspect ratio is used it will be distorted. I am aware there is an option to
raw edit shape boundaries but it is not very easy to use and the GUI sometimes freezes up
during raw edits - I considered submitting a bug report but could not reliably reproduce
the problem myself. :(
- Currently there is no way to add JPEG tags with transparency. Imported JPEG images will
be assigned (correctly) as JPEG2 tags and there is no option to add an alpha channel to
them. Importing PNG files provides an unsatisfactory substitute as having many Lossless
tags results in very large files.
I can think of two possible solutions (and there may be better options I don't know)
1. The easy fix: Make it possible to edit tag type so so JPEG2 tags could become JPEG3 and
an alpha channel could be added.
2. The hard fix: Add an option to convert Lossless tags to JPEG3, i.e. take the PNG image,
convert the RGB channels to JPEG and keep the alpha. This option is available in many
other tools such as Adobe's own Flash MX and even the old png2swf utility of the SWFTools
Either option will work fine for my use case as long as they could be automated from the
With the latest nighly you can re-replace and image tag with the same image, but defining
a different image format.
So you can do the following:
Export DefineBitsLossless (5) image to file => image.png
ffdec.bat orig.swf new.swf 5 image.png jpeg2
with this way you can convert even from jpeg2 to jpeg3, too. or from jpegX to losslessY,
or between lossless types.
is it enough?
Or I can add a
-convert 5 jpeg3 (or similar, i haven't think about the final format, yet) command line
In this case it needs only 1 execution, you don't have to export it first.
Would it be helpful for you?
Stretch/shrink is not ready yet.
The convert command can be general, later it can be used for example to convert between
DefineTextX, DefineButtons, Shapes, Fonts, PlaceObject tags, ...
When somebody needs it, I can implement it quite easily.
Just 1 more detail:
ffdec.bat -replace orig.swf new.swf 5 image.png jpeg3
Will create a DefineBitsJpeg3 tag, but it will contain a png file inside.
So if you need jpeg+alpha, you have to create image.jpg + image.bin (alpha), then:
ffdec.bat -replace orig.swf new.swf 5 image.jpg jpeg3
ffdec.bat -replaceAlpha orig.swf new.swf 5 image.bin
Nightly779 is doing exactly what I wanted, thank you. It only takes a few seconds to
generate a jpg bitmap and alpha mask from PNG files using ImageMagick so I am all good
I see that you adding code for stretch/shrink and I look forward to test it when it's done
I thought about it again and the -convert option may be more flexible. I have come across
files with incorrectly assigned image tags (PNG image wrapped inside a JPEG3 tag IIRC, I
will try to find the file and submit it in a separate issue) that could not be decompiled
properly; the ability to change tag types in situ could have helped. Please also add it if
it won't be too much trouble.
On the same note, it would also be quite handy to be able to change CharacterID to another
unused number. Currently my scripts leave a lot of gaps in Character ID sequence as images
gets replaced and removed. Something like this is not essential but would help to tidy up
the structure of the final product.
change CharacterID to another unused number: added, it is called replaceCharacterId, check
the command line help for more info
If you specify a used number, then the swf will be broken.
so for example this is wrong:
-replaceCharacterId 1,2,2,3 (replace id=1 with id=2, replace id=2 with id=3)
correct order is:
-replaceCharacterId 2,3,1,2 (assume that id=3 is unused)
nofill parameter added for shape import.
When it is specified, ffdec will resize the shape bounds during the shape import
You can try it in the following way:
export a shape tag to png (in the example from as2.swf export Shape 1 to 1.png)
Edit the image, increase the width, decrease the height.
ffdec.bat -replace as2.swf as2_2.swf 1 1.png nofill
I did not want to change the previous behavior (aspect ratio is not preserved), which is
This is why the parameter is called nofill. It will preserve the aspect ratio.
Did you try the "sort" and "pack" modes of the -replaceCharacterId command?
So now only the -convert functionality is missing from this issue, right?
Thank you very much. Everything seems to work as described in nightly794. This issue can
be closed now.
P.S. I never found out about the "pack" and "sort" options (should have followed your
commits more closely) and ended up writing something silly like this
ffdec.bat -replaceCharacterId "unregularised.swf" "regularised.swf"
Those options are very thoughtful of you. Now I don't have to deal with a monstrosity of
fifty numbers and commas :)
you can use the command line help, it shows the possible parameters:
(btw: the constant string parameters are (should be everywhere) case insensitive - of
course when it is a classname, it is case sensitive, because you can have Class_a and