JPEXS Free Flash Decompiler Issue Tracker

If you are looking for the decompiler itself, visit https://github.com/jindrapetrik/jpexs-decompiler

: WARNING - support of the decompiler is now VERY LIMITED. There are no active developers. This means waiting times in the issue tracker are very long and mostly depend on community. Sorry for the inconvenience.

List of issuesList of issues

#985 Features request: Stretch shape to fit image. JPEG tags with transparency.
Author: user laforet
Date created:
Type: feature
Visibility: Everybody
Assigned to:
State: closed Help

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 suite. Either option will work fine for my use case as long as they could be automated from the CLI :) Many thanks Laforet
developer
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 parameters 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.
developer
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.
developer
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 and ffdec.bat -replaceAlpha orig.swf new.swf 5 image.bin
user
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 here. I see that you adding code for stretch/shrink and I look forward to test it when it's done :)
user
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.
developer
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)
developer
In the previous example i forget to add the input and output filenames. -replaceCharacterId orig.swf mod.swf 2,3,1,2
user
-replaceCharacterId seems to work pretty well. It's really nice that when CharacterID is changed all its dependencies gets updated too and there is no extra work to do. Thank you.
developer
nofill parameter added for shape import. When it is specified, ffdec will resize the shape bounds during the shape import (replace) 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. run: 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 "fill". 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?
developer
-convert added. for example: -convert in.swf out.swf 1 jpeg2 So i think everything is implemented from this issue. Please test it, then let me know when i can close it.
State: new→upgraded
user
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" 31,1,32,3,33,5,34,7,39,9,40,11,41,13,42,15,......... Those options are very thoughtful of you. Now I don't have to deal with a monstrosity of fifty numbers and commas :) Cheers Laforet
developer
you can use the command line help, it shows the possible parameters: ffdec.bat -replacecharacterid (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 Class_A, too)
State: upgraded→closed