as is the backdrop of a canvas, the image assigned to an imagewell, the icon assigned to a menu item, the image assigned to a report picture, the icon on a tool bar button
[quote=454937:@Dave S]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[/quote]
It should go way back… since other than ADDING IMAGESETS, the XML format I do not believe has changed… So older projects won’t find imagesets as there won’t be any, and everything should be “Picture” type
I tried a project from 2007r4 BUT it didnt like the extension apparently and said it was an invalid Xojo project (its not but …)
Changed the extension to xojo_xml_project and it opened and analyzed the project just fine
So except for the false “this isnt a xojo project” it seems it can go a long way back
Dave - maybe open the xml and see if it contains a “RBProjectVersion” node ?
The XML projects from that era just have an “xml” extension
This version does not rely on the file extension, but instead looks “inside” as Norman suggested above. So it should work with just about ANY past version of RealBasic/RealStudio/Xojo that uses a variation of the current XML project file format. The output report also now tells you what version was used to last save the program being analyzed.
In 2015r1 it report 28 images and 14 are not referenced, 14 are.
Unfortunately, all of them are referenced (I think, I checked two or three). The one I recall is displayed into a Canvas using g.DrawPicture and the image was - like all others - imported into the project. That image (and two others “not referenced”) is displayed in my about window
For the file type, I forgot it only reads xml projects, so after getting the error message, I exported to xml the project and it gives the result above.
The best way to use this app is to rename, rather than immediately delete, the apparently unused images.
Prefix them with zz or similar.
Try to compile.
If compiling works, save the project with a new name
Then delete the zz items and try to compile again.
If it is still ok, save with a new name and move on.
(Off topic, having done this, I was able to remove 60 images from one project.
But the size of the built and packaged app went up by a few Kb! Must be some artefact of the compression algorithm.)
Ive done that and I hope this will help. The trouble have been removed between Applications versions, but I provided full explanations from my methodology.
Sorry Emile , your “explanation” did not help… as a matter of fact I am still confused as to if your believe there is an issue or not. And since you can’t/won’t supply an example project I have no way of knowing if your code has a valid image situation that I need to modifiy my code to locate properly.
If your project has EXTERNAL MODULES and the only image references are in those modules, the current version of IRA will tag them as un-used.
Today I will see if I can compensate for this
EDIT : doesn’t seem likely, as external seems to only be stored in BINARY format, which is beyond the current scope of IRA to decode. The same will hold true for any ENCRYPTED modules. So the only way would be to create a “copy” of your app, Import all the externals, Decrypt any encrypted modules and save as XML
As a project may include EXTERNAL modules (stored in BINARY format), and or ENCRYPTED modules, neither of which can be read by the Image Analyzer. If a project contains either/both of these types of modules and unaccounted for images, a warning similar to this will appear in the HTML report
[quote]
NOTE : This project has one EXTERNAL module and one ENCRYPTED module which contain code that is not accessible to this analysis. These modules may contain image references that could not be accounted for below.[/quote]