Recent

Author Topic: [SOLVED] TImage read problems  (Read 2778 times)

JD

  • Hero Member
  • *****
  • Posts: 1848
[SOLVED] TImage read problems
« on: April 02, 2020, 04:08:00 pm »
Hi there everyone,

I am trying Lazarus 2.1 on the FPC 3.2 compiler & I noticed the following anomaly with the TImage component.

If I try to open a form with a TImage on it, I get a data stream read error (see attachment)

Any ideas how I can solve this problem?

Cheers,

JD
« Last Edit: April 16, 2020, 02:00:57 pm by JD »
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: TImage read problems
« Reply #1 on: April 02, 2020, 04:59:19 pm »
The most probable cause is an error in the form resource; maybe you hand-edited the .lfm? Can you attach that .lfm to a post so we can see what's it reading?
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

jamie

  • Hero Member
  • *****
  • Posts: 6128
Re: TImage read problems
« Reply #2 on: April 03, 2020, 02:37:16 am »
its also possible an existing project from an older version of Laz, different format..
The only true wisdom is knowing you know nothing

eljo

  • Sr. Member
  • ****
  • Posts: 468
Re: TImage read problems
« Reply #3 on: April 03, 2020, 02:46:47 am »
any chance of saving the form with the timage only from a working copy of the IDE and attaching it here? I'm interested to see what the stream has at that position.

JD

  • Hero Member
  • *****
  • Posts: 1848
Re: TImage read problems
« Reply #4 on: April 06, 2020, 08:23:05 pm »
Here is an example of a published project to demonstrate the error.

It is just a form with a single TImage component. Inside the component is the folder_200.png from Lazarus' /images directory.

Thanks a lot for your assistance.

JD
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: TImage read problems
« Reply #5 on: April 06, 2020, 09:04:05 pm »
Hi!

I had just a look at your project, which seems to be totaly broken:

* No Picture in the TImage component
* No dependencies for unit1 in the project inspector
* Unit1 is not loaded when I load the project

I would say: throw it away and start a new project. Whatever happend.

Winni

JD

  • Hero Member
  • *****
  • Posts: 1848
Re: TImage read problems
« Reply #6 on: April 07, 2020, 09:46:01 am »
Hi!

I had just a look at your project, which seems to be totaly broken:

* No Picture in the TImage component
* No dependencies for unit1 in the project inspector
* Unit1 is not loaded when I load the project

I would say: throw it away and start a new project. Whatever happend.

Winni

I've done that several times already. The problem is the TImage component. Did it save the picture I put in it? Is it reading the picture correctly when I reopen the file?

JD
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

JD

  • Hero Member
  • *****
  • Posts: 1848
Re: TImage read problems
« Reply #7 on: April 07, 2020, 10:07:36 am »
Here is another project. A more recent one with a bigger image. I still get the same problems.

a) I put the image (jpg) in a TImage component
b) I save the project and then close it
c) I reopen the project and I get the TImage read errors
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

JD

  • Hero Member
  • *****
  • Posts: 1848
Re: TImage read problems
« Reply #8 on: April 07, 2020, 10:09:54 am »
This is a screenshot of my source editor with the TImage component on the Form before I closed the project attached above.

As you can see, the only thing in the project is a TImage with a picture in it.

Any assistance to resolve this problem will be greatly appreciated.

JD
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: TImage read problems
« Reply #9 on: April 07, 2020, 10:12:55 am »
My suggestion would be to try using an alternative format (such as .png), rather than .jpg.

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: TImage read problems
« Reply #10 on: April 07, 2020, 11:11:09 am »
Hi!

It also could happen that the jpg-picture is buggy.
There are a lot of buggy JPGs around. A lot of apps know that
and have implemented a "robust" algorithm.
Perhaps Lazarus did not do that.

Try to take another jpg-picture.

Winni

wp

  • Hero Member
  • *****
  • Posts: 11910
Re: TImage read problems
« Reply #11 on: April 07, 2020, 04:36:51 pm »
JD, you seem to be on Windows. Is Laz 32bit or 64 bit? You mention in the first post that you migrated to  laz-trunk/fpc3.2. I tested laz-trunk/fpc3.04, laz-trunk/fpc-fixes, laz trunk/fpc-trunk, and laz-fixes/fpc3.2 (all 32 bit on Win10, 64bit) - no issue so far when I follow your steps described in reply #7. When I load the demo projects of reply #4 and #7 I do not get an error message, but the image component is empty.

I have no idea what's wrong with your system... The easiest remedy might be to try a clean rebuild of fpc and lazarus.

@winni (regarding reply #5): The project is ok. JD uses laz trunk, and therefore some xml files are written in a different syntax and thus are not understood by older versions. The symptom is always an apparently empty project. In the transition time until Laz 2.2 (or current trunk) is release and fully established, pulished files should be saved with the checed option "Maximize compatibility of project files (lpi and lps)" (in "Project options" > "Miscellaneous") -- this will cause a lot of trouble I fear...

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: TImage read problems
« Reply #12 on: April 07, 2020, 05:40:02 pm »
Okay.
Learned something new today.
Thanx

Winni

JD

  • Hero Member
  • *****
  • Posts: 1848
Re: TImage read problems
« Reply #13 on: April 16, 2020, 10:50:12 am »
JD, you seem to be on Windows. Is Laz 32bit or 64 bit? You mention in the first post that you migrated to  laz-trunk/fpc3.2. I tested laz-trunk/fpc3.04, laz-trunk/fpc-fixes, laz trunk/fpc-trunk, and laz-fixes/fpc3.2 (all 32 bit on Win10, 64bit) - no issue so far when I follow your steps described in reply #7. When I load the demo projects of reply #4 and #7 I do not get an error message, but the image component is empty.

I have no idea what's wrong with your system... The easiest remedy might be to try a clean rebuild of fpc and lazarus.

@winni (regarding reply #5): The project is ok. JD uses laz trunk, and therefore some xml files are written in a different syntax and thus are not understood by older versions. The symptom is always an apparently empty project. In the transition time until Laz 2.2 (or current trunk) is release and fully established, pulished files should be saved with the checed option "Maximize compatibility of project files (lpi and lps)" (in "Project options" > "Miscellaneous") -- this will cause a lot of trouble I fear...

@wp

I use Lazazus 32bit. I did a clean reinstall of Lazarus 2.1/fpc 3.2rc1 and I created a new project with only a TImage component in it. I added a screencapture of mine, saved the project, closed it and reopened it successfully. Everything was fine.

BUT after I rebuilt Lazarus after adding other packages I use (downloaded using Online Package Manager), I tried opening the same simple project that worked perfectly earlier and the same problem reappeared!!!  :o :o

I honestly don't know why this is happening. I only installed Lazarus 2.1 to get the new radial features in TChart. If there is a way to use new radial features in TChart with Lazarus 2.0.7, I will be happy to go back to my older version.

Otherwise I'm stuck. So does anybody have the same problem after adding additional packages to Lazarus 2.1?

Thanks,

JD
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

wp

  • Hero Member
  • *****
  • Posts: 11910
Re: TImage read problems
« Reply #14 on: April 16, 2020, 11:13:12 am »
I use Lazazus 32bit. I did a clean reinstall of Lazarus 2.1/fpc 3.2rc1 and I created a new project with only a TImage component in it. I added a screencapture of mine, saved the project, closed it and reopened it successfully. Everything was fine.

BUT after I rebuilt Lazarus after adding other packages I use (downloaded using Online Package Manager), I tried opening the same simple project that worked perfectly earlier and the same problem reappeared!!!  :o :o
Remove the packages that you installed one by one and run your test program every time after you rebuilt-the IDE after package removal. When the test program is working again you can conclude that you removed the faulty package. Report it here. Hopefully it is maintained and somebody can fix it. Being able to install a packages from OPM does not guarantee that it is working correctly.

There were too many changes in TAChart and many cannot be backported.

 

TinyPortal © 2005-2018