If you can find a file that has the first byte of the header not 0 then i will try to look into it.
My theory is it might have been a type specification could also had been global shape flags, as these are things Westwood did previously.
That said i don't have any files to show this or found the code that reads this byte at all, it's also worth noting it might not be a byte but a word.
As for the forth byte in AverageColor, its probably padding.
Oh yea also note on AverageColor generation, it's essentially just what you get when you do Average in any image editor, but there is one difference, you need to discard the 0x0 index pixels, it averages the nontransparent pixels only, while in image editors even if you make the background transparent internally it will still fill it with white or black and then average it.
Don't quote me on this that it should be like this but as far as code goes on a quick google after a few pages i found https://www.compuphase.com/graphic/scale3.htm which seems to be a sane way to go about it. Ill have to look into it tomorrow myself see if i can find anything like that in shapeset. _________________ Tiberian Dawn, Red Alert, Tiberian Sun ,Red Alert 2,Renegade, Command & Conquer 3,Tiberium and Tiberium Wars and Westwood related image & video archive
https://picasaweb.google.com/113361105083292812413?noredirect=1
Skype live:tomsons26
Don't forget to state who are you otherwise i'll ignore the invite QUICK_EDIT
Is the image processing (worker threads) necessary before making SHP
if there are images in only one column? Are these processing only for
combining images or these do something before making SHP? QUICK_EDIT
they are necessary for the time consuming color conversion.
The Euclidean calculation may be fast for one color, but it still needs to find for every single pixel in the image the corresponding palette color.
And for this there is the slow
for x=0 to bitmap.width
for y=0 to bitmap.height
{
getPalettePixelColor(x,y)
}
function necessary.
Each row is an image conversion (and combining) job, and the number row-jobs are equally split among the threads.
You can see the result of the row-jobs if you enable the temp image output, as then the threads save the converted image in the palette indexed file.
The converted (and combined) images are collected (thus the big memory usage after conversion) and then saved as SHP in the main thread, which is the only time the interface freezes, as i didn't want to put this in separate thread as well. _________________ SHP Artist of Twisted Insurrection: Nod buildings
i need more infos than that.
-program version
-which images do you used? (size, color format etc) Best upload them so i can recreate the issue
-how many images
-at which point do you got the message (during image processing? while shp saving?)
... _________________ SHP Artist of Twisted Insurrection: Nod buildings
Version 01.01.00.07
-(bugfix) loading palette indexed images was not supported. Now loaded directly without any color conversion.
-(bugfix) SHP frames loaded in the 2nd or 3rd imagelist caused an exception
-(update) images with 32bpp ARGB, 24bpp RGB and 8bpp palette indexed color formats are directly supported. All other image color formats are converted to 32bpp ARGB before processing image in color conversion.
-(update) added options to optimize canvas size
-(update) BitFlags added
-(update) option to calculate average radar color added (ignoring all transparent background pixel)
-(update) Routine to identify SHPs changed to be less strict. Previously anything with a BitFlag value of >3 was discarded as invalid SHP.
@deathreaperz
No clue if your problem is fixed with this update. I didn't had my crystal ball at hand to see what went wrong in your case. _________________ SHP Artist of Twisted Insurrection: Nod buildings
The average color should be checked on by default, as we don't know
what else it is used for apart from radar color. Also its last used status is
not saved.
The optimize canvas checkbox should be unchecked by default and when
making it checked, by default the keep center should be checked. Let the
user uncheck the keep center checkbox manually.
Have you checked if the resultant SHP is not affecting position in game
relative to its selection box? It should be safe in all conditions like a
structure would be having more than a single shp like buildup, animations
to accompany the main structure, this option shouldn't result in having
SHPs rendering at different alignment. QUICK_EDIT
Have you checked if the resultant SHP is not affecting position in game
relative to its selection box? It should be safe in all conditions like a
structure would be having more than a single shp like buildup, animations
to accompany the main structure, this option shouldn't result in having
SHPs rendering at different alignment.
I think you realise the app merely adjusts according to provided art and force its dimension to smallest possible will not work with separate same building shps despite keeping center at the moment when processing singular shps. As is, canvas optimization is more for the pros at this point than average joe that may not realise the potential inconsistencies.
Buildings wise this would need possibility of inserting all building shps in and then use them together for the measurement but still split like originals were, else you'd be forced to split them yourself afterwards. Adding all in single list now seems not to apply the canvas optimization in my test when giving multiple shps despite makes common shp.
Also some minor bug, i tried dragging shps into the image lists and 3rd image list would not put at the first frame (put a lot of blank frames instead first) when dragging shp in unless you use the load function(?) QUICK_EDIT
The canvas crop feature could be dropped altogether as it won't make
much difference when using compression in SHP. Or it could be made
available in some expert mode. For now it could be kept unchecked
by default.
Drag and drop on the first empty row of the column that you desire.
It works for first row of 3rd column as well. QUICK_EDIT
D&D always checks where exactly you drop. Only if there are no rows present, it starts inserting the images from top.
This is because the tool can combine images, where you might want to combine images 64-96 with something, so you would drop your additional 32 images on the 64th cell, not the first cell.
Same is true with load images, which also checks the cell location where you right clicked and inserts the images in the that column starting from that row.
It could be that "opt. canvas" alone (keep centered unchecked) is not keeping the image at the correct place ingame.
I have to do some more tests with optimize canvas and check how ShapeSet optimized the canvas.
However, with "keep centered" checked, it works as it should and optimizes the canvas fine.
\Edit
opt. canvas with "keep centered" off works the same as ShapeSet.
however if the colored pixel where off center yet correct positioned ingame, they get misaligned due to the canvas optimization.
In ShapeSet, WW used a simple rectangle drawn on the first frame to set the canvas. The same could be done in Image Shaper if you have "keep centered" off.
Attached is a sketch showing the canvas optimization methods.
In the 3rd case the image gets misaligned, since it lost its relative position to the center as offset is set to 0,0.
Note: when the SHP is saved, each frame has it's own minimal sized canvas set. In the example the SHP would store only data for the 18x24 big image.
If you did test with a single SHP case like infantry, then could try like
a turreted building where the base, buildup, turret and its anim have
different non transparent dimensions. QUICK_EDIT
should work fine if you select opt. canvas and keep centered
-you should only make sure buildup and base have same dimensions
-turret and anims can have different dimensions
as long as they all are kept centered, there isn't a problem in minimizing the canvas _________________ SHP Artist of Twisted Insurrection: Nod buildings
new version uploaded
next to some new functions, this one has a few optimizations in the interface to speed up the work with the tool. Mainly you don't have to right click selected files anymore to set the frame specific settings like radar color.
Version 01.01.00.08
-(bugfix) optimize canvas failed when empty frames were included
-(bugfix) when using "RLE_Zero" compression, the bitflag wasn't set in the SHP
-(update) last used average color checkbox value stored in ini
-(update) when enabling "optimize canvas", "keep centered" is enabled by default as well
-(update) option added to use a custom color as transparent background color during color conversion
-(update) option added to copy only the transparent pixel when combining this image with a base image
-(update) changes in the "Image/Frame Settings" are instantly applied to the selected images/frames
"combine transparent pixel"
this option is for those who use different render passes, where one is some kind of mask, with the mask defining the area that should be kept and all other pixel set transparent.
e.g.
you have 2 render passes, one with heavy blur anti-aliasing into the background, one without anti-aliasing and sharp borders.
-load in ImageList 1 the anti-aliased blurred images which alone would give a dark outline during conversion
-load in ImageList 2 the sharp aliased images and set on these "combine transparent pixel"
Now the transparent pixel of the mask are copied onto the blurred image.
This way you can remove the dark outline, while keeping the blurred or anti-aliased inner part. _________________ SHP Artist of Twisted Insurrection: Nod buildings
I wasn't trying to force your hand or anything, most people won't even be interested in the code in this community and its not like the OpenRA team or even Olaf are really likely to pursue the matter and they are the only ones who would have standing to do anything about enforcing the GPL on you. As it is, if I can't rebuild the entire tool, a bit of the source isn't exactly useful.
You should be careful about incorporating open source code in your tools if you don't intend to play by the open source rules though, the GPL requires you make the entire source available for a binary you distribute that contains some GPL code, not just the bit of GPL code you happen to use.
I personally think its just the right thing to do to open source tools for modding. I am aware that I have released tools myself without source because they were based on code I couldn't just okay the release of on my own, but if I could have I would.
I'd like to second this. It's awesome that people want to build stuff based on OpenRA, but it is only fair and is a condition of the license that you don't restrict that same right from others.
The GPL doesn't force you to post the code publically, but it does require you to give all the code that makes up the binary to anyone who asks for it. QUICK_EDIT
new version uploaded
Version 01.01.00.09
-(update) create images expanded with SHP(TS) file format, allowing each frame to be saved as SHP
-(update) create images filename can now use an asterisk *, to keep the original filename for the single frame
This basically allows to convert single images into single frame SHPs, like a batch process.
@pchote:
The source for the SHP creating routine is uploaded on the previous page.
If someone wants the complete program source code, he can write me a PM and i'll send it. _________________ SHP Artist of Twisted Insurrection: Nod buildings
Joined: 22 Nov 2010 Location: Iszkaszentgyorgy, Hungary
Posted: Fri Jan 12, 2018 8:43 pm Post subject:
Haven't tried the new release yet, but the source-request-by-PM sounds fair to me already. GJ LKO regardless, tool's useful. _________________ "If you didn't get angry and mad and frustrated, that means you don't care about the end result, and are doing something wrong." - Greg Kroah-Hartman
=======================
Past C&C projects: Attacque Supérior (2010-2019); Valiant Shades (2019-2021)
=======================
WeiDU mods: Random Graion Tweaks | Graion's Soundsets
Maintainance: Extra Expanded Enhanced Encounters! | BGEESpawn
Contributions: EE Fixpack | Enhanced Edition Trilogy | DSotSC (Trilogy) | UB_IWD | SotSC & a lot more... QUICK_EDIT
Hm, I ran into a big issue when trying to import a construction yard I am doing into the shp builder, assume 700 frames, 320x240 each, the SHP builder was simply incapable of importing such amount of files, freezing it for more than 20 minutes, by then I just had to kill the process, on the other hand, your program takes little to no time. Thanks man, at a first glance, it seems to work great. _________________
Though 20 min for SHP Builder isn't unusual. After an hour i would have said it stopped working, but the import in SHP Builder can really take that long. It's also normal for SHP Builder that the interface freezes, but it still works in the background.
When it crashes due to too many frames/memory usage it'll usually throw an exception. _________________ SHP Artist of Twisted Insurrection: Nod buildings
I noticed something, when loading images, the program takes more time to display the image list on the main window than loading the rest of the images. (Think, the frame had 29 frames while the the whole list was had 682 files)
Another thing, a request, did you ever thought of adding an option to process all the frames after an x number as shadow frames (All pixels asigned to a single color)?
The most logical option would be to render the second half of the frame list, but please dont do that, ORA allows more flexibility on where you can put the shadows. _________________
I noticed something, when loading images, the program takes more time to display the image list on the main window than loading the rest of the images.
I noticed that too, that when populating the onscreen list, it seems to take
a little longer as if it is refreshing the viewable list on adding every list item.
When it starts loading the offscreen list it goes fast. It started happening
only with v01.01.00.06 onwards. But the delay is negligible. QUICK_EDIT
Another thing, a request, did you ever thought of adding an option to process all the frames after an x number as shadow frames (All pixels asigned to a single color)?
The most logical option would be to render the second half of the frame list, but please dont do that, ORA allows more flexibility on where you can put the shadows.
a) yes, but deliberately not implemented any automatism, because it's just a few clicks to assign the shadow frames their own customized palette
and an automatism could work wrong in several cases (e.g. explosion anims without shadows).
I might add a way to apply the custom shadow palette a bit faster, removing some repetitive steps.
b) nah, wouldn't have done this in such a imprecise way anyway, due to issues mentioned in a)
c) i'll see what i can do about the image loading performance issue _________________ SHP Artist of Twisted Insurrection: Nod buildings
A single pixel on any row in the last frame (c 0039.png) is causing problem
with the RLE_0 implementation in this tool. Uncompressed works fine. Also
SHP Builder works fine. QUICK_EDIT
Version 01.01.00.10
-(bugfix) RLE-Zero encoding algorithm crashed when the encoded result data was bigger than 2 times the uncompressed data (RLE encoded worst-case is 3 times the size as uncompressed)
-(bugfix) imported files ignored the "fixed Backcolor" setting
-(update) faster file import in datagridview (now refreshes only once after import is complete)
The problem was the RLE_Zero encoder.
In SHP Builder it constantly raises the byte-array size while it creates the encoded data.
Since arrays in C# need several performance heavy steps to be resized and i didn't want to use the slower List, i simply had the byte-array for the RLE-result preallocated and scaled 2 times the size as the uncompressed byte-array, thinking it would be sufficient.
Unfortunately the worst case for RLE-Zero compressed data can make it 3 times the size as the uncompressed data, in case of a single pixel. _________________ SHP Artist of Twisted Insurrection: Nod buildings
Could have put refresh after loading 500 or 1000 images. Loading 64k
images works but in the meantime it shows the application as Not
Responding and the grid view area is blank. QUICK_EDIT
Version 01.01.00.11
-(update) JASC Palette format supported
-(update) loading files now done in a separate thread to prevent/reduce freezing interface
-(bugfix) when loading multiple SHPs, an empty cell was added after each SHPs last frame _________________ SHP Artist of Twisted Insurrection: Nod buildings
For weapon muzzle anim the Start/End= trick doesn't work and I have to separate the file into 32 directions which it's kind of boring and dull to do.
So can you add the following feature or equivalence:
Combine every N frames into one file. For example if I have 960 frames and set N=30, then I get 32 shps with 30 frames. _________________
Version 01.01.00.12
-(update) if preview window is focused, ctrl+c copies the image into the clipboard
-(update) Split result added, which allows to split the frames evenly into multiple SHPs.
Note: haven't made it with a split every n-th frame, since this would be a bit more inconvenient in the interface, as it needs an additional checkbox to turn it on/off
or
the user would always have to make sure the entered number is high enough when creating single SHPs (which is quite the norm).
Right now the default is 1, and only when you want to split it up you raise the value to the number of files that you want.
In your case you use 32.
Note: leftover frames from the division without remainders are skipped.
e.g.
10 frames divided into 6 files would result into 6 files with 1 frame each and 4 frames being skipped. _________________ SHP Artist of Twisted Insurrection: Nod buildings
For that you could create the necessary number of empty images and simply drag/drop them into the tool. _________________ SHP Artist of Twisted Insurrection: Nod buildings
interesting, it's again the RLE encoder.
It seems even triple size of the pre-dimensioned result array is not big enough. So now it increases the array as necessary and this should make an end to these kind of encoder bugs.
thanks for this bug report
new version uploaded
Version 01.01.00.13
-(bugfix) RLE Encoder fixed (again). Now resizes array during encoding if encoded data exceeds the preallocated array size. _________________ SHP Artist of Twisted Insurrection: Nod buildings
Joined: 24 May 2004 Location: Flanders (Be) Posts:300000001
Posted: Tue Sep 04, 2018 2:32 pm Post subject:
Lin Kuei Ominae wrote:
they are necessary for the time consuming color conversion.
The Euclidean calculation may be fast for one color, but it still needs to find for every single pixel in the image the corresponding palette color.
And for this there is the slow
for x=0 to bitmap.width
for y=0 to bitmap.height
{
getPalettePixelColor(x,y)
}
function necessary.
You can speed it up significantly by storing the found indices in a hashmap with the bare RGB value as key. After all, a large part of these pixels will be background colour, and on sprites you generally won't have millions of unique colours anyway. _________________ QUICK_EDIT
That's exactly how it works already and it did indeed raise the speed significantly.
Next to the multi-threading, that was one of the first things i made to increase processing speed. _________________ SHP Artist of Twisted Insurrection: Nod buildings
Joined: 24 May 2004 Location: Flanders (Be) Posts:300000001
Posted: Tue Sep 04, 2018 6:36 pm Post subject:
Heh. I should really look into multithreading... right now my Engie File Converter has this typical tendency to freeze the UI for a few seconds while it's saving stuff
(in my defense, it was originally created for converting uncompressed single images from some Nintendo 64 format to normal PC formats.)
As for buffer sizes, for the TS and Dune II whitespace collapsing RLE implementations I never needed to worry about that; the .Net framework has a MemoryStream class, which is basically an automatically-expanding memory buffer handled as a stream. So yea, I never even need to look at the maximum size. I just write to it and then retrieve the final result as byte array.
I should actually implement that for my other compression algorithms too... _________________ QUICK_EDIT
Joined: 19 Aug 2009 Location: Moscow State University
Posted: Wed Oct 24, 2018 9:40 am Post subject:
Can you add a save/load project feature? Should save all image routes, frame orders, and palette ignore/transparent settings. In case you would render a different size, or use a different palette.
And if I put in frames it will place last frame on first, I don't know why, but have to manually remove it and add it to the end.
All good points and worth being added. Not sure when i have time to implement them though.
kenosis wrote:
And if I put in frames it will place last frame on first, I don't know why, but have to manually remove it and add it to the end.
Do you use a special file browser?
I tested with Total Commander and Windows Explorer (Win7) adding a list of files. Regardless if selecting the files from top to bottom, or bottom to top, or multiple one by one via ctrl, the files are added in the same order as highlighted in the file browser.
kenosis wrote:
Would it be possible to adjust orders by drag/drop?
gonna have to see how to add this. All the special cases aren't that easy to implement like
-multiple files d&d to a place where there are already files in the list (what happens to the files in the 2nd and 3rd column? should they move with the files from the 1st column, since they usually belong together?)
-1 file d&d on another, should it replace the existing one? should they switch places? should the d&d file get inserted into the list above the dropped cell? _________________ SHP Artist of Twisted Insurrection: Nod buildings
Joined: 19 Aug 2009 Location: Moscow State University
Posted: Wed Oct 24, 2018 5:36 pm Post subject:
If can really drag&drop to edit order, consider the columns, maybe a check box can be used to select single column or all columns. Or if not the check box, default single column can be better, because multi column can be achieved by multiple times d&d, but you cant move single column with the move all columns default.
I think people using image shaper would probably import all images from the beginning, and adjust them later, so if you d&d, it means deleting existing frames and adding after the target - drag frames 1-25 onto frame 27 would mean delete 1-25, and old frame 1 becomes frame 28. Or not drag drop, but cut/paste (onto selected frame), a note on paste effect (will add above/under target frame) for users can be enough already.
Regardless if selecting the files from top to bottom, or bottom to top, or multiple one by one via ctrl, the files are added in the same order as highlighted in the file browser.
Version 01.01.00.15
-(update) internal Drag & Drop added to the datagrid cells. If a cell is empty, the d&d value is set, otherwise a new row inserted. Existing values are not replaced!
-(update) [File] menu added to menustrip, which offers functions to save and load a project. A project includes the data from the datagrid and the complete palette setup.
Note: due to a quirk of the DataGridView, when d&d multiple cells, you have to keep shift/ctrl pressed and have to start dragging from the last selected cell. Otherwise the selection is lost/changed.
Note2: this tool is using the old kernel32 (Write/Get)PrivateProfileString functions. It needs to be tested if these work well enough when saving/loading huge projects with thousands of frames. _________________ SHP Artist of Twisted Insurrection: Nod buildings
You should always reserve an empty row at the bottom cause when I try to add images to the end it's easy to add to the last frame accidentally because the gap after the last frame is way too slim
Version 01.01.00.16
-(update) "Load from Clipboard" added to the Datagrid right-click menu. The clipboard image is saved in the Temp subfolder.
-(bugfix) Copy, Cut, Paste in Datagrid right-click menu fixed
-(update) Datagrid ensures a single empty row at the end
-(update) preview window moves to front as well, when program gets focus
\edit
Version 01.01.00.17
-(bugfix) annoying windows warning sound removed when adding files
-(bugfix) "combine transparent pixel" is applied only to the image in the column left of it
-(update) if multiple cells are selected when adding files, the user is asked if the files should be duplicated into the cells
-(update) the audio file SHPfinished.wav is played when SHP conversion is done
The audio file can be deleted, if someone doesn't likes it being played each time an SHP is done.
Duplicating the file(s) works only if the selected cells are all in the same column and the number of selected cells is bigger than the number of files to import. _________________ SHP Artist of Twisted Insurrection: Nod buildings
Joined: 19 Aug 2009 Location: Moscow State University
Posted: Sat Mar 23, 2019 7:36 pm Post subject:
3 example images.
You put them into columns accordingly and have "combine transparent pixel" checked for the 3rd column, and you will get a normal ship with dithered shield.
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum