Weird problem with Images Components - image

My problem is when I open my old project (project that work by same Delphi Version), I lost the entire image picture contents. By this I mean picture property is None.
When I open dfm with notepad, the picture property has Data but when I open it with delphi, its picture data will disapear. It seems that Delphi recognize picture data invalid.
(in this situation Delphi erase all data).
This happen with all Image Components and all Components that have Picture Property
I encounted this problem when I reinstall Delphi, and I am now running Delphi version 2007.

Your problem is probably caused by a missing package supporting the stored image format. Check for any image or graphics library that has been installed on your previous system and is missing in the current one. A good candidate for that is always GraphicEx.

Related

LibreOffice Writer - captions crop figures

I am creating a report meant to be read/edited by MS Word. To do that I have created it from scratch and saved as .docx.
In this report I am including some images together with captions. All of the captions were added manually. Everything went fine, I have saved the document and closed Writer.
Now I want to put my hands on it again and, upon opening the report, this is what I am seeing:. Previously the figure was showing fine inside the text box (that inserting a caption creates). The text box is in the same position and size, but there appears to be a boundary over which it just displays white. I can reduce the figure's size inside the boundary of visibility, and a glimpse of the captions appears too .
Note that the red arrow disappears too.
Needless to say, I can not work on a 100+ pages document and then check again each picture, delete it and re-create it, check again the cross references and so on. I would much rather work with LaTeX, but I am required to deliver a .docx file.
I am working on Ubuntu 20.04, Libreoffice is updated to version 6.4.6.2 and the only plugins I have equipped it are TexMath and Zotero.
Thank you for your time.
I noticed the same thing. It seems to be an issue already in Libreoffice Writer between Linux and Windows. If you create a document on Linux with a cropped image and then open the file in Libreoffice on Windows the cropping of that image is already messed up. Happens to me with Libreoffice Version 6.3.5.2.

Delphi XE6 - How to make user defined components image show up on the pallette

I am migrating from 2007 to XE6 and have several user defined components written by both myself and third party.
When installing components in delphi 2007 you just add the components to the library and it automatically found and loaded the DCR of the same name into the dpk file and it loaded the image onto the pallette.
In delphi XE6 is does not automatically load the image files, instead you just get a default image which is the same for every user defined component.
I sought and found some topics on this subject which described manually adding the DCR files into the project source which I have done but it does not work and/or it is unreliable.
Firstly when I reinstall the bpl, the samples pallette (which I have loaded all my components into) deletes all the components I have just installed and shows nothing.
When I shut down Delphi and restart, the components appear on the pallete but randomly some of the images are still the default images.
I get a different result, every time I re-intall the bpl, each time different images have the correct image and others have the default image. It appears quite random which ones don't appear.
Any clues what is going on?
I think I found a work around for this problem.
I noticed that I have SynEdit loaded and it does not have any problem with putting its Icons on the palette, so I loaded up the dpk to see how it did it.
It seems that the problem exists when each component is added as a seperate file to the library.
The key is to make just one file eg MyLibReg.pas and add each component file into the "Uses" section of the unit. Create the Register procedure and then register all the components in one go in the Register procedure. You will have to go through each file, find the individual register procedures, copy and paste the class names into MyLibReg.pas's register procedure then REM out those procedures in those files.
Next, load up image editor and create a new dcr file called MyLibReg.dcr.
The next bit is a bit tedious, load up all the dcr files from all your user components into image editor and copy and paste the images into MyLibReg.dcr, you will need to create all the bitmap names manually then paste the images in.
Save the dcr in the same directory as MyLibReg.pas.
In XE6 select Component/Install Component, Select "Install Into new package".
in unit filename navigate to MyLibReg.Pas and continue and build/install the package.
Voila, all the correct icons come up.
It seems XE6 can only reliably work with one dcr file per bpl.

Delphi - Want an automated way of maintaining the link between a "source" image file and images in my project

One thing I find Delphi doesn't manage well is the link between image "source" files and the image components in my project (D2006 here but I'm assuming it applies to all versions).
Say I have various static images in my project - backgrounds, toolbar button glyphs, various bits of eye candy, etc. I have a corresponding collection of PNG/BMP etc. files that I have sourced, scraped or created, and these have been loaded into the image components at design time.
One problem is that there seems to be no automated way of finding out three months later what source image file was used to load an image component. This becomes more of an issue when you need to edit one or more images.
So what I would really like, is some way of including the image source files in a build of a project. I.e. when I did a build, all of the image components would be reloaded from the sources first. At present, when I modify some of my images with PhotoShop or similar, I'm faced with a lengthy and error-prone process to reload the altered images into their respective image containers.
Is creating a resource with all of the images bound into it and adding code to load the image components at startup a viable way to go? Do others have this problem, and how do you manage it?
None of the standard components support what you are asking for. However, Thany's TPngImageList component does support the ability to associate a user-defined string with each image in the list.
Otherwise, to know which file belongs with which image, I would suggest using an .rc file to compile the external image files into the app's resources at compile-time, and then you can load the image resources into your components dynamically at run-time instead of at design-time. That way, you can manage the image files however you want. When you change a file, it will automatically be linked into the app on the next compile.
You might load the same images in runtime, and add these images in version control to ease maintenance. There are also command line tools for Lazarus (I guess you might find similar for Delphi too) which can put files into resources that you app can later use.
I load the images from ico files, populate a imagelist and then use it in my Virtual string tree for various nodes. Easy to change the ico files.
/Mikael

How to use the existing Png-Shell-Thumbnail for my file types?

I am currently writing an application working with specially prepared image data. Another tool prepares the images (basically PNGs with additional data stored in the meta-data section). Now my tool works with these files, but not with all PNGs, so "we" decided to use a different file extension. So far, so good.
Now, because I am a lazy sack I implemented some file type registration to allow double-clicking on the file and opening it in my application (no problem at all).
And here is my Question:
It would be cool if the windows explorer could still show me the thumbnail previews for my files. Since they basically are still PNG files, it should be possible without writing my own shell extension (at least I believe so).
I quickly tried to copy all registry keys and values from HKCR.png to HKCR.mInDat (my file name ext) and it worked. However, I would prefere knowning what I am doing ;-)
Which of the registry settings are responsible for the thumbnail preview control and which can I use to get the preview for my file types?
I tried to google it, but I failed, since it seems I am unable to come up with the right buzz-words to find the info I need. Please, help me.
Thank you!
Yours,
3of4
Simple:
[HKEY_CLASSES_ROOT\.apng]
#="apng"
"Content Type"="image/png"
"PerceivedType"="image"
[HKEY_CLASSES_ROOT\apng\shellex\{BB2E617C-0920-11d1-9A0B-00C04FC2D6C1}]
#="{3F30C968-480A-4C6C-862D-EFC0897BB84B}"

Interface Builder doesn't show some of my resource images

I have almost 20 images in PNG format added to my current project on Xcode (under the proper group, Resources). Unfortunately, library window's Media tab doesn't show some of them. And if I create an UIImageView and set one of these invisible images from code, nothing shows up. I also tried from IB with adding a UIImageView and set its source image.
Is this problem a image format related issue or is there a tiny detail I'm missing.
What log says:
Could not load the "07_clock_icon.png" image referenced from a nib in the bundle
The solution to this is a bit silly, but it definitely works:
Close XCode and the Interface Builder. Now, instead of opening XCode then opening the project, navigate to the project in Finder and double click on the project. When you open your xib file the blue file not found images will flash up, then be replaced with the correct images and the dropdown will show all your images in the Inspector.
Heyy! I figured it out. It's a refreshing bug. So just copy and replace those images that did not load into your project folder, and then hold Shift Command K (to clean your project). After Clean Up it should work perfectly! Enjoy!
If you dragged the images from the Finder into the Resources folder in XCode the images should show up in IB as well. At least it does so in my setup.
Maybe the images are 8-bit PNG images. I believe Cocoa requires them to be 24-bit because of the alpha transparency. PNG 8-bit doesn't support the alpha channel, as it's more like a GIF image.
But from the error you posted It seems IB couldn't find the resource at all. Which is understandable if it doesn't load the resources from XCode in its library.
Assuming you selected the option to let XCode copy the files into your project and neither XCode nor the Finder complain when you make the copy... I wonder if there might be some file corruption? Maybe try recreating them or opening and resaving them from another graphics application (or even Preview.app).
btw- 8-bit PNGs have worked fine for me.
Same problem was encountered by me. The problem is with the image. The image has been some how corrupted.Try to open the image in photoshop and you will see it doesn't open with photoshop.
I solved the problem by changing the image format to PNG-24 and everything works fine for me.
Hope this will solve your issue.
Regards,
Rupesh R Menon

Resources