If you are looking for the decompiler itself, visit https://github.com/jindrapetrik/jpexs-decompiler
NEW : We have got a new blog where we post some interesting SWF internals info.

#984 Replacement of shapes with images have issues in 6.0.1
Author:
laforet

Date created:
Type: bug
Visibility: Everybody
Assigned to:
State: closed 

> What steps will reproduce the problem?
- I will illustrate this problem using a minimal file which contains the minimal
components of 1 image, 1 shape and 1 frame, however the behavior is the same for any .swf
file.
00000013: SetBackgroundColor
00000018: DefineBitsLossless2 (1)
000001cf: DefineShape3 (2)
000001f6: RemoveObject2 Depth: 50
000001fa: PlaceObject2 (2) Depth:
00000201: ShowFrame
00000203: End
- Replace the shape with another image using the latest stable build (6.0.1). I used a PNG
image with transparency.
- Do the same replacement in 5.3.0.
> What is the expected output? What do you see instead?
- Both versions manage to update the shape with the new image, but the outputs have
different problems.
- 6.0.1 generates the following file:
00000013: DefineBitsLossless2 (3)
000007ad: SetBackgroundColor
000007b2: DefineBitsLossless2 (1)
00000969: DefineShape3 (2)
00000993: RemoveObject2 Depth: 50
00000997: PlaceObject2 (2) Depth:
0000099e: ShowFrame
000009a0: End
The new tag (3) is placed at the beginning of the file. When the swf contains hundreds of
shapes it becomes very hard to follow. More importantly I have had many problems when a
swf modified like this is projected inside another, making the output unusable.
- 5.3.0 generates the following output
00000013: SetBackgroundColor
00000018: DefineBitsLossless2 (1)
000001cf: DefineBitsJPEG2 (3)
00000941: DefineShape3 (2)
0000096b: RemoveObject2 Depth: 50
0000096f: PlaceObject2 (2) Depth:
00000976: ShowFrame
00000978: End
- The new tag (3) is at where it should be (right after the original image it replaced)
and I have never had problems like I did with 6.0.1.
- However the tag type in the new file is always DefineBitsJPEG2 no matter what the
imported image format is. Transparency is somehow preserved but there is no way to edit
the alpha channel because it is not JPEG3/4. I have repeated the test with larger PNG
images and can confirm that the imported image is not compressed at all judging by image
size, so it was probably used as is but labelled as JPEG2.
> Please provide any additional information below. If the problem is related to a SWF
file, attach it here, otherwise we can't help you.
- As far as my use case is concerned, the behavior of 5.3.0 is more desirable as the
output is usable while the ones from 6.0.1 are not. The only thing needs fixing is to make
it assign the correct tag type after importing the image, and even better, make it
possible for users to change the tag type if the automatically assigned ones are wrong.
- Examples attached for your reference
Best regards
Laforet
Tag order fixed.
Please try the latest nightly build.
Btw: PNG in DefineBitsJPEG2 tag was correct in version 5.3.0. SWF specification allows to
embed PNG, JPG, GIF files in DefineBitJPEG tags.
State: new→upgraded
I'll add an image format parameter to force create lossless/lossless2/jpeg2/jpeg3/jpeg4
tags
Thank you, I will try the nightly and get back to you.
The image format option would be one of the features I requested in #985 as well.
In nightly 778 you can specify the format parameter for image and shape imports.
When you import an image, and the specified tag type is different from the original type,
then ffdec will remove the old tag, and create a new. (Sam as when you want to replace a
DefineBits image, it was already replaced with a DefineBitsJpeg2 tag)
Please let me know if i can close this issue.
Tested nightly779 and it is working like a charm now. Thank you very much. Please close
this issue now.
State: upgraded→closed