I have an app with hundreds of icons and images in ImageSets… Over the course of developing this, I have added more, decided not to use some etc… And realized that there were some images that I wasn’t using, but were still in the project.
So I developed a quick and dirty app to analyze a Xojo Project (XML format only) to determine what Imagesets (or stand alone Pictures) are declared in the project, and then attempt to find which ones are actually used
To be considered used. the image reference must be in one of the following situations
a property value of a control (a canvas backdrop for example)
on the right side of an assign ( p=myImage )
used in a DrawPicture command
If you can think of any other situation, please let me know
In the mean time here is a zip file containing both macOS and Windows executables for your pleasure
NOTE : I take no responsibility for how you use the output of the report that is produced. Please verify any results before deleting images from your projects
NOTE : I have tested the macOS version, but not the Windows one, but there should be no differences
Handy tool.
I was amazed at how many unwanted items there were, but found that a good number in my project were only referenced as parameters into methods.
No… that syntax was actually one of the first ones I tested…
However this latest update includes a Tokenizer (from a past project) to process SOURCELINES now
I just ran my test program again, it it works for me
g.DrawPicture dark_add1x ,0,0
// comment
Dim p As picture = lite_add1x
Call test 1 ,headshots , 3
dim a as string=" dark_add1x "
my test program also includes 3 unused images
if “a_algerian” a resource in the IDE? or is it a picture that your app creates on the fly?
my app won’t find the second type as there is no permanent reference to look for
yes.
There are another 12 similar images that suffer the same way
I’ll see if I can find a common aspect
Right now, my process is run your app, search my app, agree or disagree with your assessment,
then rename the image as zz and try to compile.
Any that go bink get renamed back.
Even that process is still going to result in a good wodge of images no longer needing to go into the compiled build…
Something odd happens with images used in a segmented control.
yes they do
in XML try decode hex - thats why the entry is tagged as “Hex” bytes
each “segment” is separated by &u0D
within each segment you’ll find other separators for each “field” - usually this is &u0A
you get NAME, ICONNAME, SELECTED
In the (old) IDE you could add an image, and set it to be transparent = 1 (white is transparent)
But the image also had a mask property in the inspector, where you could assign a black and white image of the same size as a mask, selected from other images that were in the project.
[quote=455001:@Dave S]THANKS… I had just figured out where the iconname was… but that helps alot
any other place where an image resource might be in a block?[/quote]
well hex blocks are just blobs of data and they are specific to the particular kind of control/resource in use
there could be other places but I cant think of any off the top of my head
There is another new version on its way.
Various people (Thanks Jeff) have found other situations I had not thought of…
Such as SegCtrl icons and Mask for old style picture resources.