View Issue Details

IDProjectCategoryView StatusLast Update
0012253ScribusGraphics / Image Framespublic2019-11-23 13:27
ReporterJLuc Assigned Toale  
PrioritynormalSeverityminorReproducibilityN/A
Status assignedResolutionopen 
Product Version1.5.0svn 
Summary0012253: [WIP PATCH] Importing image in non empty frame should preserve scale and position
DescriptionAs of today, scribus resets some image frame properties when importing an image inside an image frame. It does so even if there is allready an image in it, with a scale and other altered properties.
- scale x
- scale y
- X
- Y

Scribus should not reset the properties and shoult at least keep the specified scale.

Beside, as a consequence of this behaviour, preset values for image frames (Preferences > tools> Images) are useless because image frame are created with specified scale, but since they are created empty, they ought to be filled, and scale and xy are reset to 100% and (0,0) when importing an image in it.


Tagspatch
PatchYes

Relationships

related to 0015181 closedjghali item tools / image: scaling is ignored 
has duplicate 0011797 closedjghali Importing image should not reset zoom 
has duplicate 0005542 assignedale Replacing image does not preserve Image Scaling settings 
related to 0012584 closedale [PATCH] scripter's loadImage should keep the frame settings 

Activities

JLuc

2014-04-22 07:21

developer   ~0031755

Last edited: 2014-09-02 08:59

Some more thoughts :

Most of the time, when replacing the content of an imageframe with another image, it's because the 2nd one is felt better, but it has to go roughly in the same place, it is often the same type of image, and the frame properties that were used for the first one are also good for the 2nd one, or, at least, are the best possible base to start with more editing and finetuning.

Preferences provides a way to set default value or behaviour for some options of the various tools. It does this "application-wide" or "document-wide".
---> In an image frame, not reseting (= keeping as is) the scale of the previous image, when replacing this image with a new one, provides a kind of improved "frame-wide" default value for the properties of the frame that are not related with the image file itself. That is meaningfull.

The most required remembered properties are all the related-to-scale properties.
Then there is the rotation : IMO it logicaly should be remembered too. (all the more since it's so much easier to create a new frame from scratch with empty properties than to set all properties to some allready set desired values !)

Note : As for now, the effects are not deleted or reset when importing a new image into a frame. It should be the same for other frame-related properties.

[EDIT :] Other most required to-be-remembered property is offset X and Y.
Other possible one is image effect.

ale

2014-08-02 12:22

manager   ~0033146

attached a patch that removes the initialization code from loadImage().

i suggest that we switch the default behavior and if people show that there is a need for (partially) re-initialization of the frame, we can implement it.

jluc is proposing a "cleaning brush" button that would act in a similar way as the same button for text...

but, maybe, no initialization is ever needed... if you want the default values, isn't it easier to create a new frame?

ale

2014-08-02 12:25

manager  

load_image.diff (2,849 bytes)   
Index: scribus/pageitem.cpp
===================================================================
--- scribus/pageitem.cpp	(revision 19357)
+++ scribus/pageitem.cpp	(working copy)
@@ -9211,6 +9211,28 @@
 	return buffer;
 }
 
+void PageItem::initalizeImageFrame()
+{
+	oldLocalScX = m_imageXScale = 72.0 / pixm.imgInfo.xres;
+	oldLocalScY = m_imageYScale = 72.0 / pixm.imgInfo.yres;
+	oldLocalX = m_imageXOffset = 0;
+	oldLocalY = m_imageYOffset = 0;
+	if ((m_Doc->itemToolPrefs().imageUseEmbeddedPath) && (!pixm.imgInfo.clipPath.isEmpty()))
+	{
+		pixm.imgInfo.usedPath = pixm.imgInfo.clipPath;
+		QString clPath(pixm.imgInfo.usedPath);
+		if (pixm.imgInfo.PDSpathData.contains(clPath))
+		{
+			imageClip = pixm.imgInfo.PDSpathData[clPath].copy();
+			pixm.imgInfo.usedPath = clPath;
+			QTransform cl;
+			cl.translate(m_imageXOffset*m_imageXScale, m_imageYOffset*m_imageYScale);
+			cl.scale(m_imageXScale, m_imageYScale);
+			imageClip.map(cl);
+		}
+	}
+}
+
 bool PageItem::loadImage(const QString& filename, const bool reload, const int gsResolution, bool showMsg)
 {
 	bool useImage = (asImageFrame() != NULL);
@@ -9218,7 +9240,6 @@
 	if (!useImage)
 		return false;
 	QFileInfo fi(filename);
-	QString clPath(pixm.imgInfo.usedPath);
 	pixm.imgInfo.valid = false;
 	pixm.imgInfo.clipPath="";
 	pixm.imgInfo.PDSpathData.clear();
@@ -9269,34 +9290,23 @@
 		is->setItem(effectsInUse);
 		undoManager->action(this, is);
 	}
-	double xres = pixm.imgInfo.xres;
-	double yres = pixm.imgInfo.yres;
 	PictureIsAvailable = true;
 //	PicArt = true;
 		
+	/*
+	// ale: scribus used to reinitialize the image settings when a new image get's loaded.
+	// this was not a good idea.
+	// for now, do not initialize any setting. in specific cases, we might want to initiliaze some of the
+	// settings. we will add it as needed.
+	// we might also add a way to "manually" reset all the fields to the frame settings values.
 	if (Pfile != filename)
 	{
-		oldLocalScX = m_imageXScale = 72.0 / xres;
-		oldLocalScY = m_imageYScale = 72.0 / yres;
-		oldLocalX = m_imageXOffset = 0;
-		oldLocalY = m_imageYOffset = 0;
-		if ((m_Doc->itemToolPrefs().imageUseEmbeddedPath) && (!pixm.imgInfo.clipPath.isEmpty()))
-		{
-			pixm.imgInfo.usedPath = pixm.imgInfo.clipPath;
-			clPath = pixm.imgInfo.clipPath;
-			if (pixm.imgInfo.PDSpathData.contains(clPath))
-			{
-				imageClip = pixm.imgInfo.PDSpathData[clPath].copy();
-				pixm.imgInfo.usedPath = clPath;
-				QTransform cl;
-				cl.translate(m_imageXOffset*m_imageXScale, m_imageYOffset*m_imageYScale);
-				cl.scale(m_imageXScale, m_imageYScale);
-				imageClip.map(cl);
-			}
-		}
+		initalizeImageFrame();
 	}
+	*/
 		
 	Pfile = fi.absoluteFilePath();
+	QString clPath(pixm.imgInfo.clipPath);
 	if (reload && pixm.imgInfo.PDSpathData.contains(clPath))
 	{
 		imageClip = pixm.imgInfo.PDSpathData[clPath].copy();
load_image.diff (2,849 bytes)   

JLuc

2014-08-02 21:15

developer   ~0033155

I fully agree with ale.

ale

2014-08-08 09:21

manager   ~0033205

any thoughts?

Kunda

2014-09-02 12:23

updater   ~0033455

+1
If there is a need (because it makes sense for ones workflow) to set a reset or default settings button I'm +1 for that as well. If that day comes, I suggest that it appear .on-hover over the image a small 'reset' icon in the upper top right or left of the image.

ale

2016-06-19 16:44

manager   ~0041690

time flies so fast...

kahaus

2016-06-19 20:40

reporter   ~0041694

+1

here is my use case scenario ...

Lets say I am taking pictures of a house interior and want to present different moods by switching or dimming different lights in the scene. I put my camera on a tripod. Now I keep taking pictures from exactly the same point with the same perspective. Between the shots I just change (switch, dim, move ...) the various lights. Finished the photoshooting. I got 10 identical shots, just the lighting differs.
Lets make a simple layout for the photos in Scribus. I properly place, scale and crop the first photo in an Image Frame. Now the next photo should be cropped and scaled the same way as the previous one (it has the same point of view and perspective, just the illumination is different). Finally now it would be cool to copy the Image Frame and just replace the image without caring about scale and position.

This is just one example. It applies for any situation, where you want to present various minor changes of otherwise same image. It can be diagram, technical drawing, 3D design and so on.

So for me the default behavior would be that Image Frame remembers the properties of the image and there is a possibility to reset the settings (could be a button in the properties panel or on-hover button on the Image Frame)

... my two cents :)

JLuc

2016-10-31 17:12

developer   ~0042246

Last edited: 2016-10-31 17:15

AMOF, *some* settings are preserved :
- all image effects are preserved
- scale values are not preserved, but scale X-Y link mode IS ! (that is : the chain/notchained that sets whether X changes should impact Y changes or not)

That is not consistent and should be fixed.

ale

2016-11-01 12:58

manager   ~0042278

@kahaus: a sensible use case but...

... but, i wonder if your case is that common...

i mean: putting much effort on getting a big bunch of picture to be "the same" and then not edit them in Gimp to all have the right crop?

if you are preparing your work that carefully you're very likely to have the right size of both the frame and image (and they will be matching :-)

but we should definitively keep your use case in mind!

kahaus

2016-11-01 18:49

reporter   ~0042286

yeah i see ... it is very likely, that my use case could be sort of rare. it was just an idea.

i do not do a hard crop of the images i put in the layout - some space for maneuvering is usually needed in case the page layout changes later a little bit. it often happens (like changing page borders and so on). if the image has a precise crop and page layout changes, i need to go through all of the images in Gimp, crop them again and insert and scale them again in Scribus. that means basically layouting the images from scratch. doing all the cropping in Scribus (without fiddling in some other software) is very convenient and time saving.

anyway, i am very thankful for your response and very much appreciate what all of you have achieved so far - big respect. keep up the good work!

Thanks! K.

brewsky

2017-01-17 15:46

reporter   ~0043372

+1
At the architects office I work we use this workflow all the time.
We make many different versions(frequently updated) of the same image (mostly views of 3d-models) that are cropped on the page.
Opening every single image for editing in gimp takes much time.
This is the only reason that indesign is still partly used.

ale

2018-09-28 15:32

manager   ~0045486

scribus should not the position and scale when loading an image...
i'm not sure if there is ever a need for clearing those values (on top of being able to zero them with a few clicks and keystrokes in the properties palette)...
... but, to be sure, let's do a button for it.

i will soon upload a new revision fo the patch above that:
- does not clear the position and scale when loading a new image
- clear them when the button is pressed.

please, review and -- possibly -- accept the patch as soon as it is uploaded... don't let it rot for four more years...
(you've even been warned in advance...)
clear-scale.png (58,739 bytes)   
clear-scale.png (58,739 bytes)   

Issue History

Date Modified Username Field Change
2014-04-21 22:54 JLuc New Issue
2014-04-21 23:21 jghali Relationship added has duplicate 0011797
2014-04-22 07:21 JLuc Note Added: 0031755
2014-04-22 07:22 JLuc Note Edited: 0031755
2014-04-22 07:22 JLuc Note Edited: 0031755
2014-04-26 13:00 JLuc Note Edited: 0031755
2014-04-26 13:01 JLuc Note Edited: 0031755
2014-08-02 09:20 ale Relationship added related to 0012584
2014-08-02 12:22 ale Note Added: 0033146
2014-08-02 12:25 ale File Added: load_image.diff
2014-08-02 12:25 ale Summary Importing image in non empty frame. => [PATCH] Importing image in non empty frame.
2014-08-02 21:15 JLuc Note Added: 0033155
2014-08-08 09:21 ale Note Added: 0033205
2014-08-08 19:15 Kunda Status new => feedback
2014-09-02 08:59 JLuc Note Edited: 0031755
2014-09-02 12:23 Kunda Note Added: 0033455
2014-10-24 22:57 Kunda Patch => Yes
2015-09-17 20:10 Kunda Category Graphics / Image Frames => Graphics/Img Frames
2015-09-17 20:11 Kunda Category Graphics/Img Frames => Graphics / Image Frames
2016-05-11 09:27 ale Tag Attached: patch
2016-05-11 13:06 ale Status feedback => new
2016-06-19 16:44 ale Note Added: 0041690
2016-06-19 20:40 kahaus Note Added: 0041694
2016-10-31 17:12 JLuc Note Added: 0042246
2016-10-31 17:15 JLuc Note Edited: 0042246
2016-10-31 17:17 JLuc Tag Attached: #please_test
2016-11-01 12:58 ale Note Added: 0042278
2016-11-01 18:49 kahaus Note Added: 0042286
2017-01-17 15:46 brewsky Note Added: 0043372
2018-03-06 13:31 JLuc Relationship added related to 0015181
2018-03-06 13:36 JLuc Description Updated
2018-03-06 13:36 JLuc Description Updated
2018-03-06 13:37 JLuc Tag Detached: #please_test
2018-09-27 15:07 JLuc Relationship added has duplicate 0005542
2018-09-27 15:08 JLuc Summary [PATCH] Importing image in non empty frame. => [PATCH] Importing image in non empty frame should preserve scale and position
2018-09-28 15:32 ale File Added: clear-scale.png
2018-09-28 15:32 ale Note Added: 0045486
2018-10-02 05:41 ale Assigned To => ale
2018-10-02 05:41 ale Status new => assigned
2019-11-23 13:27 ale Summary [PATCH] Importing image in non empty frame should preserve scale and position => [WIP PATCH] Importing image in non empty frame should preserve scale and position