[scribus] Easier word wraparound and graphic images.

Gregory Pittman gpittman at iglou.com
Tue Dec 16 01:54:47 UTC 2014


On 12/15/2014 12:08 PM, a.l.e wrote:
> hi
>> On Mon, 15 Dec 2014 17:10:36 +0100
>> JLuc <jluc at no-log.org> dijo:
>>
>>> BTW I remember xpress had (has) a
>>> "automatically compute contour line out of image white areas" option
>>> that was pretty usefull.
>> I recall that as well and, if I recall correctly, the feature was also
>> available in InDesign and CorelDRAW. The feature didn't always work
>> perfectly because the program sometimes guessed wrong about white areas
>> in the image. But at least it automatically created a contour line and
>> minimized the efforts needed to edit it.
>>
>> It would be a great feature for Scribus, but I don't know how much
>> effort it would take to add it.
>>
>
> can probably even be made as a python script using PIL...
>
Here is a script I wrote some years ago, which bypasses the contour line 
by simply creating another empty frame on top of the selected one, turns 
on text flow around frame, and there you have it!

There is a value of a variable named "border", here set to 10, but which 
could be changed, or even add the ability to change it on the fly with a 
valueDialog.
Also note that for consistency, the document units are changed to 
points, then back to the original after creating the frame, if different.

****begin script****

# -*- coding: utf-8 -*-

#####################################################################
# This is a simple script to create an empty frame superimposed #
# on a selected frame, creating a border. Change border value to #
# suit. #
# Script will fail if you do not have a frame selected. #
# #
# 2005.09.21  Gregory Pittman #
# May be used and modified freely #
#####################################################################

import sys
try:
     import scribus

except ImportError:
     print "This script only works from within Scribus"
     sys.exit(1)

def makebox(x,y,w,h):
       a = scribus.createImage(x, y, w, h)
       scribus.textFlowMode(a, 1)

def main():
       if scribus.haveDoc():
       pageunits = scribus.getUnit()
       scribus.setUnit(0)
           scribus.setRedraw(1)
           x,y = scribus.getPosition()
           w,h = scribus.getSize()
           x2 = x - border
           y2 = y - border
           w2 = w + border * 2
           h2 = h + border * 2
           makebox(x2,y2,w2,h2)
           scribus.setUnit(pageunits)
           scribus.redrawAll()
       else:
           result = scribus.messageBox('Error','You need a Document 
open, and a frame selected.')

# Change the 'border' value to change the size of space around your frame
border = 10
main()

****end script****

Greg




More information about the scribus mailing list